Hi Jerry,
This doesn’t fix the problem. The MAX9296 driver seems to be incomplete. If dst-csi-port
is set to ‘b’, the driver does not configure pipes correctly. It looks like this is is due to the all of the pipes being initialised with MAX9296_CSI_CTRL_1
in max9296_pipes_reset()
, and the switch statement in max9296_get_available_pipe()
only looking at these pipes if dst_csi_port == GMSL_CSI_PORT_A
Both excerpts from max9296.c
:
175 static void max9296_pipes_reset(struct max9296 *priv)
176 {
177 /*
178 * This is default pipes combination. add more mappings
179 * for other combinations and requirements.
180 */
181 struct pipe_ctx pipe_defaults[] = {
182 {MAX9296_PIPE_X, GMSL_CSI_DT_RAW_12,
183 MAX9296_CSI_CTRL_1, 0, MAX9296_INVAL_ST_ID},
184 {MAX9296_PIPE_Y, GMSL_CSI_DT_RAW_12,
185 MAX9296_CSI_CTRL_1, 0, MAX9296_INVAL_ST_ID},
186 {MAX9296_PIPE_Z, GMSL_CSI_DT_EMBED,
187 MAX9296_CSI_CTRL_1, 0, MAX9296_INVAL_ST_ID},
188 {MAX9296_PIPE_U, GMSL_CSI_DT_EMBED,
189 MAX9296_CSI_CTRL_1, 0, MAX9296_INVAL_ST_ID}
190 };
191
192 /*
193 * Add DT props for num-streams and stream sequence, and based on that
194 * set the appropriate pipes defaults.
195 * For now default it supports "2 RAW12 and 2 EMBED" 1:1 mappings.
196 */
197 memcpy(priv->pipe, pipe_defaults, sizeof(pipe_defaults));
198 }
518 static int max9296_get_available_pipe(struct device *dev,
519 u32 st_data_type, u32 dst_csi_port)
520 {
521 struct max9296 *priv = dev_get_drvdata(dev);
522 int i;
523
524 for (i = 0; i < MAX9296_MAX_PIPES; i++) {
525 /*
526 * TODO: Enable a pipe for multi stream configuration having
527 * similar stream data type. For now use st_count as a flag
528 * for 1 to 1 mapping in pipe and stream data type, same can
529 * be extended as count for many to 1 mapping. Would also need
530 * few more checks such as input stream id select, dst port etc.
531 */
532 if ((priv->pipe[i].dt_type == st_data_type) &&
533 ((dst_csi_port == GMSL_CSI_PORT_A) ?
534 (priv->pipe[i].dst_csi_ctrl ==
535 MAX9296_CSI_CTRL_0) ||
536 (priv->pipe[i].dst_csi_ctrl ==
537 MAX9296_CSI_CTRL_1) :
538 (priv->pipe[i].dst_csi_ctrl ==
539 MAX9296_CSI_CTRL_2) ||
540 (priv->pipe[i].dst_csi_ctrl ==
541 MAX9296_CSI_CTRL_3)) &&
542 (!priv->pipe[i].st_count))
543 break;
544 }
545
546 if (i == MAX9296_MAX_PIPES) {
547 dev_err(dev, "%s: all pipes are busy\n", __func__);
548 return -ENOMEM;
549 }
550
551 return i;
552 }