- for (i = 0; i < s_data->numfmts; i++) {
- if (mf->width == frmfmt[i].size.width &&
- mf->height == frmfmt[i].size.height &&
- mf->maxframerate == frmfmt[i].framerates[0] &&
- hdr_en == frmfmt[i].hdr_en) {
- s_data->mode = frmfmt[i].mode;
- s_data->fmt_width = mf->width;
- s_data->fmt_height = mf->height;
- s_data->fmt_maxfps = mf->maxframerate;
- break;
+ if (s_data->use_sensor_mode_id &&
+ s_data->sensor_mode_id >= 0 &&
+ s_data->sensor_mode_id < s_data->numfmts) {
+ dev_dbg(&client->dev, "%s: use_sensor_mode_id %d\n",
+ __func__, s_data->sensor_mode_id);
+ s_data->mode = frmfmt[s_data->sensor_mode_id].mode;
+ s_data->fmt_width = mf->width;
+ s_data->fmt_height = mf->height;
+ s_data->fmt_maxfps = mf->maxframerate;
+ } else {
+ for (i = 0; i < s_data->numfmts; i++) {
+ if (mf->width == frmfmt[i].size.width &&
+ mf->height == frmfmt[i].size.height &&
+ mf->maxframerate == frmfmt[i].framerates[0] &&
+ hdr_en == frmfmt[i].hdr_en) {
+ s_data->mode = frmfmt[i].mode;
+ s_data->fmt_width = mf->width;
+ s_data->fmt_height = mf->height;
+ s_data->fmt_maxfps = mf->maxframerate;
+ break;
+ }