static int m5mols_s_power(struct v4l2_subdev *sd, int on) { struct m5mols_info *info = to_m5mols(sd); int ret; if (on) { ret = m5mols_sensor_power(info, true); if (!ret) ret = m5mols_sensor_armboot(sd); if (!ret) ret = m5mols_setup_default(sd); } else { ret = m5mols_sensor_power(info, false); } return ret; }
/** * m5mols_s_power - Main sensor power control function * * To prevent breaking the lens when the sensor is powered off the Soft-Landing * algorithm is called where available. The Soft-Landing algorithm availability * dependends on the firmware provider. */ static int m5mols_s_power(struct v4l2_subdev *sd, int on) { struct m5mols_info *info = to_m5mols(sd); int ret; if (on) { ret = m5mols_sensor_power(info, true); if (!ret) ret = m5mols_sensor_armboot(sd); if (!ret) ret = m5mols_init_controls(info); if (ret) return ret; info->ffmt[M5MOLS_RESTYPE_MONITOR] = m5mols_default_ffmt[M5MOLS_RESTYPE_MONITOR]; info->ffmt[M5MOLS_RESTYPE_CAPTURE] = m5mols_default_ffmt[M5MOLS_RESTYPE_CAPTURE]; return ret; } if (is_manufacturer(info, REG_SAMSUNG_TECHWIN)) { ret = m5mols_mode(info, REG_MONITOR); if (!ret) ret = m5mols_write(sd, AF_EXECUTE, REG_AF_STOP); if (!ret) ret = m5mols_write(sd, AF_MODE, REG_AF_POWEROFF); if (!ret) ret = m5mols_busy(sd, CAT_SYSTEM, CAT0_STATUS, REG_AF_IDLE); if (!ret) v4l2_info(sd, "Success soft-landing lens\n"); } ret = m5mols_sensor_power(info, false); if (!ret) { v4l2_ctrl_handler_free(&info->handle); info->ctrl_sync = false; } return ret; }