@@ -486,7 +487,7 @@ int multisensor_pgm_window_common (int sensor_port, ///< sensor p
dev_dbg(g_dev_ptr,"frame16=%d\n",frame16);
if(composite&&(!async)){
printk("*** ERROR (Should be disabled in multisensor_pgm_multisens() ) CANNOT USE COMPOSITE MODE WITH FREE RUNNING SENSOR ***\n");
dev_err(g_dev_ptr,"*** ERROR (Should be disabled in multisensor_pgm_multisens() ) CANNOT USE COMPOSITE MODE WITH FREE RUNNING SENSOR ***\n");
composite=0;
SETFRAMEPARS_SET(P_MULTI_MODE,0);// Do we need to force anything here? If it was async->free transition? Or just TRIG mode should have all the dependencies of P_MULTI_MODE
}
...
...
@@ -502,13 +503,17 @@ int multisensor_pgm_window_common (int sensor_port, ///< sensor p
sFlipY[i]=flipY^(composite?((thispars->pars[P_MULTI_FLIPV]&(1<<i))?1:0):0);// in single (non -composite) mode use just flipY
}elseif((wt+wh-height1-vblank2)<(height2+vblank3+(sensor->minHeight*dv))){// Only first 2 sensors are needed - reduce second frame (10359, not the sensor)
height2=wh+wt-height1-vblank2;// only 10359, not the sensor
}else{// all 3 sensors needed, adjust height3 to make sure 10359 sends out exactly wh/dv lines (vblank* could be adjusted to compensate for Bayer when flipping)
X3X3_I2C_RCV2(sensor_port,I2C359_SLAVEADDR,I2C359_VERSION,&bitstream_version);// just 2 bytes, not 4
dev_dbg(g_dev_ptr,"Exceeded number of unbalanced writes on port %d: (%d > %d), reading i2c, got 0x%lx\n",sensor_port,get_unbalanced_writes(sensor_port),i2c_get_max_unbalanced_writes(),bitstream_version);
}
// wait for the write buffer to have some room
if(!x393_xi2c_ready_wr(sensor_port)){
dev_dbg(g_dev_ptr,"Had to wait for the i2c sequencer while multisensor_write_i2c(%d, %s, 0x%x, 0x%x, 0x%x)\n",
printk("10353 sensor clock set to %d\n",(int)thispars->pars[P_CLK_SENSOR]);
dev_info(g_dev_ptr,"10353 sensor clock set to %d\n",(int)thispars->pars[P_CLK_SENSOR]);
udelay(100);// 0.0001 sec to stabilize clocks
// X3X3_RSTSENSDCM; // FPGA DCM can fail after clock change, needs to be reset
...
...
@@ -1018,11 +1065,11 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
}
#endif
rslt=multisensor_set_freq(sensor_port,1,thispars);// first time (1)
if(rslt>0)printk("10359A sensor clock set to %d\n",rslt);
elseif(rslt==0)printk("10359A sensors are using 10353 system clock, as set in configuration\n");
elseprintk("10359 sensor clock failure, will use system clock from 10353 board\n");
if(rslt>0)dev_info(g_dev_ptr,"10359A sensor clock set to %d\n",rslt);
elseif(rslt==0)dev_info(g_dev_ptr,"10359A sensors are using 10353 system clock, as set in configuration\n");
elsedev_info(g_dev_ptr,"10359 sensor clock failure, will use system clock from 10353 board\n");
// Try to read chip version from each of the 3 possible sensors
printk("removing MRST from the sensor\n");
dev_info(g_dev_ptr,"removing MRST from the sensor\n");
//
sensio_ctl.d32=0;
sensio_ctl.mrst=1;
...
...
@@ -1036,9 +1083,10 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
udelay(100);
GLOBALPARS(sensor_port,G_SENS_AVAIL)|=1<<(GLOBALPARS(sensor_port,G_SENS_AVAIL));// temporary to indicate sensor detection functions that they need to initialize multisensor registers
for(i=0;i<MAX_SENSORS;i++){
// for (i=0;i<MAX_SENSORS;i++) {
for(i=0;i<3;i++){// 10359 only supports 3 sesnors, not 4
#ifdef NC353
dev_dbg(g_dev_ptr,"%s Probing sensor port %d, i2c bitdelays=0x%08x\n",__func__,i,i2c_delays(0));
dev_dbg(g_dev_ptr,"Probing sensor port %d, i2c bitdelays=0x%08x\n",i,i2c_delays(0));
rslt=multisensor_read_i2c(sensor_port,
MT9P001_I2C_ADDR+((i+1)*I2C359_INC),
P_MT9X001_CHIPVER,
...
...
@@ -1050,35 +1098,37 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
P_MT9X001_CHIPVER,
&sensor_id[i]);
#endif
// dev_dbg(g_dev_ptr,"%s Probing sensor port %d, i2c bitdelays=0x%08x, rslt=0x%x\n",__func__,i,i2c_delays(0),rslt);
// dev_dbg(g_dev_ptr,"Probing sensor port %d, i2c bitdelays=0x%08x, rslt=0x%x\n",i,i2c_delays(0),rslt);
printk("Found MT9P001 2592x1944 sensor on 10359A port %d, chip ID=%lx\n",(i+1),sensor_id[i]);
GLOBALPARS(sensor_port,G_SENS_AVAIL)|=1<<i;
dev_info(g_dev_ptr,"Found MT9P001 2592x1944 sensor on 10359A port %d, chip ID=%lx\n",(i+1),sensor_id[i]);
GLOBALPARS(sensor_port,G_SENS_AVAIL)|=1<<i;
}elseif(sensor_id[i]==0xffff){
sensor_id[i]=0;
}else{
printk("Found UNSUPPORTED sensor on port %d, chip ID=0x%lx\n",(i+1),sensor_id[i]);
dev_warn(g_dev_ptr,"Found UNSUPPORTED sensor on port %d, chip ID=0x%lx\n",(i+1),sensor_id[i]);
}
}elsesensor_id[i]=0;
}
GLOBALPARS(sensor_port,G_SENS_AVAIL)&=(1<<(GLOBALPARS(sensor_port,G_SENS_AVAIL)))-1;// remove flag used to indicate sensor detection functions that they need to initialize multisesnor registers
if(GLOBALPARS(sensor_port,G_SENS_AVAIL)==0){
printk("No supported sensors connected to 10359A board\n");
dev_warn(g_dev_ptr,"No supported sensors connected to 10359A board\n");
if(!sensor_mask)sensor_mask=GLOBALPARS(sensor_port,G_SENS_AVAIL);// if none sensors were enabled - enable all what is available (same as with WOI size)
if(composite&&(!async)){
printk("*** CANNOT USE COMPOSITE MODE WITH FREE RUNNING SENSOR ***\n");
composite=0;
SETFRAMEPARS_SET(P_MULTI_MODE,0);// Do we need to force anything here? If it was async->free transition? Or just TRIG mode should have all the dependencies of P_MULTI_MODE
dev_err(g_dev_ptr,"*** CANNOT USE COMPOSITE MODE WITH FREE RUNNING SENSOR ***\n");
composite=0;
SETFRAMEPARS_SET(P_MULTI_MODE,0);// Do we need to force anything here? If it was async->free transition? Or just TRIG mode should have all the dependencies of P_MULTI_MODE
}
// TODO: recalculate sequence when MULTISENS_EN is chnaged (tried 5 - did not modify sequence, showed first frame only)
// Here - only recalculate SENSOR_HEIGHT, skipping disabled sensors. in multisensor_pgm_window() will need to skip disabled also
// No above is not really needed, sequence+enable can be handled by application software
if(multi_unitialized&&(!composite)&&(prev_composite||((new_sensor>=0)&&(old_sensor!=new_sensor)))){// now single-sensor mode, set P_WOI* from saved parameters
printk("%s:%d:%s ",__FILE__,__LINE__,__FUNCTION__);printk("WARNING: ((thispars->pars[P_CLK_SENSOR] == prevpars->pars[P_CLK_SENSOR])) but multi_phases_initialized is not yet set (re-init?)\n");
dev_warn(g_dev_ptr,"WARNING: ((thispars->pars[P_CLK_SENSOR] == prevpars->pars[P_CLK_SENSOR])) but multi_phases_initialized is not yet set (re-init?)\n");
}
multisensor_set_freq(sensor_port,0,thispars);// not the first time. Assuming no clock chip if clock4 is not set
reset=1;
// TODO: put here calculation of the sensor phases in 10359 from bitstream data and clock rate
// clk_period= 1000000000000.0f/thispars->pars[P_CLK_SENSOR]; // period in ps
if(!thispars->pars[P_CLK_SENSOR]){
dev_warn(g_dev_ptr,"Sensor clock is not set, using default 0x%lx\n",sensor_clk);