Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
8b4b7b64
Commit
8b4b7b64
authored
Sep 25, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging with 10359 multiplexer (Eyesis mode)
parent
11d96e51
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
546 additions
and
311 deletions
+546
-311
elphel393_eyesis.dts
src/arch/arm/boot/dts/elphel393_eyesis.dts
+11
-4
clock10359.c
src/drivers/elphel/clock10359.c
+42
-18
mt9x001.c
src/drivers/elphel/mt9x001.c
+1
-1
multi10359.c
src/drivers/elphel/multi10359.c
+276
-217
multi10359.h
src/drivers/elphel/multi10359.h
+1
-1
pgm_functions.c
src/drivers/elphel/pgm_functions.c
+4
-0
sensor_common.c
src/drivers/elphel/sensor_common.c
+5
-0
sensor_i2c.c
src/drivers/elphel/sensor_i2c.c
+195
-67
sensor_i2c.h
src/drivers/elphel/sensor_i2c.h
+9
-1
x393_videomem.c
src/drivers/elphel/x393_videomem.c
+2
-2
No files found.
src/arch/arm/boot/dts/elphel393_eyesis.dts
View file @
8b4b7b64
...
@@ -265,7 +265,10 @@
...
@@ -265,7 +265,10 @@
elphel393-sensor-i2c,i2c_devices = "mt9f002 0x10 2 2 500",
elphel393-sensor-i2c,i2c_devices = "mt9f002 0x10 2 2 500",
"mt9p006 0x48 1 2 500",
"mt9p006 0x48 1 2 500",
"el10359 0x08 1 2 500",
"el10359 0x08 1 2 500",
"el10359_32 0x08 1 4 500",
"pca9500_eeprom 0x50 1 1 100",
"pca9500_eeprom 0x50 1 1 100",
"sensor_eeprom 0x50 1 1 100",
"sensor_temp 0x18 1 2 100",
"cy22393 0x69 1 1 100";
"cy22393 0x69 1 1 100";
} ;
} ;
...
@@ -285,6 +288,10 @@
...
@@ -285,6 +288,10 @@
compatible = "elphel,elphel393-mt9x001-1.00";
compatible = "elphel,elphel393-mt9x001-1.00";
};
};
elphel393_clock10359:elphel393-clock10359@0{
compatible = "elphel,elphel393_clock10359-1.00";
};
klogger_393: klogger-393@0 {
klogger_393: klogger-393@0 {
compatible = "elphel,klogger-393-1.00";
compatible = "elphel,klogger-393-1.00";
klogger-393,buffer_size = <1048576>;
klogger-393,buffer_size = <1048576>;
...
...
src/drivers/elphel/clock10359.c
View file @
8b4b7b64
...
@@ -84,25 +84,25 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
...
@@ -84,25 +84,25 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
unsigned
int
fpmx
=
CY22393_XTAL
*
(
CY22393_PMAX
+
6
);
unsigned
int
fpmx
=
CY22393_XTAL
*
(
CY22393_PMAX
+
6
);
int
divmn
,
divmx
,
err1
,
err
,
div
,
q
,
qmn
,
qmx
,
qmx1
,
fdv
,
p
,
e
,
fdvq
;
int
divmn
,
divmx
,
err1
,
err
,
div
,
q
,
qmn
,
qmx
,
qmx1
,
fdv
,
p
,
e
,
fdvq
;
pars
->
rslt
=
3
;
// other error
pars
->
rslt
=
3
;
// other error
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\
r\
n
"
,
f0
,
f
,
CY22393_OUTMAX
);
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\n
"
,
f0
,
f
,
CY22393_OUTMAX
);
f
/=
CY22393_SCALE
;
// to fit into 32-bit calculations
f
/=
CY22393_SCALE
;
// to fit into 32-bit calculations
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\
r\
n
"
,
f0
,
f
,
CY22393_OUTMAX
);
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\n
"
,
f0
,
f
,
CY22393_OUTMAX
);
if
(
f
>
CY22393_OUTMAX
)
{
if
(
f
>
CY22393_OUTMAX
)
{
pars
->
rslt
=
2
;
pars
->
rslt
=
2
;
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\
r\
n
"
,
f0
,
f
,
CY22393_OUTMAX
);
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\n
"
,
f0
,
f
,
CY22393_OUTMAX
);
return
pars
->
rslt
;
return
pars
->
rslt
;
}
}
if
(
f
<=
0
)
{
if
(
f
<=
0
)
{
pars
->
rslt
=
1
;
pars
->
rslt
=
1
;
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\
r\
n
"
,
f0
,
f
,
CY22393_OUTMAX
);
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d
\n
"
,
f0
,
f
,
CY22393_OUTMAX
);
return
pars
->
rslt
;
return
pars
->
rslt
;
}
}
divmx
=
CY22393_PLLMAX
/
f
;
if
(
divmx
>
127
)
divmx
=
127
;
// could not be <1
divmx
=
CY22393_PLLMAX
/
f
;
if
(
divmx
>
127
)
divmx
=
127
;
// could not be <1
divmn
=
CY22393_PLLMIN
/
f
;
if
(
divmn
<
1
)
divmn
=
1
;
divmn
=
CY22393_PLLMIN
/
f
;
if
(
divmn
<
1
)
divmn
=
1
;
if
(
divmn
>
127
)
{
if
(
divmn
>
127
)
{
pars
->
rslt
=
1
;
pars
->
rslt
=
1
;
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d, divmn=%d
\
r\
n
"
,
f0
,
f
,
CY22393_OUTMAX
,
divmn
);
dev_dbg
(
sdev
,
"f0=%d,f=%d, CY22393_OUTMAX=%d, divmn=%d
\n
"
,
f0
,
f
,
CY22393_OUTMAX
,
divmn
);
return
pars
->
rslt
;
return
pars
->
rslt
;
}
}
err1
=
f
;
err1
=
f
;
...
@@ -113,7 +113,7 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
...
@@ -113,7 +113,7 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
qmn
=
fpmn
/
fdv
-
2
;
if
(
qmn
<
0
)
qmn
=
0
;
qmn
=
fpmn
/
fdv
-
2
;
if
(
qmn
<
0
)
qmn
=
0
;
qmx
=
fpmx
/
fdv
-
2
;
if
(
qmx
>
255
)
qmx
=
255
;
qmx
=
fpmx
/
fdv
-
2
;
if
(
qmx
>
255
)
qmx
=
255
;
// recalculate qmn to avoid same div*qmn as already tried with lover div
// recalculate qmn to avoid same div*qmn as already tried with lover div
dev_dbg
(
sdev
,
"div=%d,qmn=%d, qmx=%d
\
r\
n
"
,
div
,
qmn
,
qmx
);
dev_dbg
(
sdev
,
"div=%d,qmn=%d, qmx=%d
\n
"
,
div
,
qmn
,
qmx
);
if
(
div
==
1
)
qmx1
=
qmx
;
if
(
div
==
1
)
qmx1
=
qmx
;
else
if
((
qmn
*
div
)
<
qmx1
)
qmn
=
qmx1
/
div
;
else
if
((
qmn
*
div
)
<
qmx1
)
qmn
=
qmx1
/
div
;
for
(
q
=
qmn
+
2
;
q
<=
qmx
+
2
;
q
++
)
{
for
(
q
=
qmn
+
2
;
q
<=
qmx
+
2
;
q
++
)
{
...
@@ -127,10 +127,10 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
...
@@ -127,10 +127,10 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
pars
->
dv
=
div
;
pars
->
dv
=
div
;
err1
=
e
/
q
/
div
;
err1
=
e
/
q
/
div
;
err
=
err1
*
div
;
err
=
err1
*
div
;
dev_dbg
(
sdev
,
"f=%d, div=%d, p=%d,q=%d, err1=%d
\
r\
n
"
,
(
f0
*
p
)
/
q
/
div
,
div
,
p
,
q
,
err1
);
dev_dbg
(
sdev
,
"f=%d, div=%d, p=%d,q=%d, err1=%d
\n
"
,
(
f0
*
p
)
/
q
/
div
,
div
,
p
,
q
,
err1
);
if
(
err1
==
0
)
{
if
(
err1
==
0
)
{
pars
->
corr
=
(
pars
->
p
<
226
)
?
0
:
((
pars
->
p
<
621
)
?
1
:
((
pars
->
p
<
829
)
?
2
:
((
pars
->
p
<
1038
)
?
3
:
4
)));
pars
->
corr
=
(
pars
->
p
<
226
)
?
0
:
((
pars
->
p
<
621
)
?
1
:
((
pars
->
p
<
829
)
?
2
:
((
pars
->
p
<
1038
)
?
3
:
4
)));
dev_dbg
(
sdev
,
"f=%d, div=%d, p=%d,q=%d, err1=%d, rslt=%d
\
r\
n
"
,
dev_dbg
(
sdev
,
"f=%d, div=%d, p=%d,q=%d, err1=%d, rslt=%d
\n
"
,
(
f0
*
(
pars
->
p
+
6
))
/
(
pars
->
q
+
2
)
/
pars
->
dv
,
(
f0
*
(
pars
->
p
+
6
))
/
(
pars
->
q
+
2
)
/
pars
->
dv
,
pars
->
dv
,
pars
->
dv
,
(
pars
->
p
+
6
),
(
pars
->
p
+
6
),
...
@@ -142,7 +142,7 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
...
@@ -142,7 +142,7 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
}
}
}
}
}
}
dev_dbg
(
sdev
,
"f=%d, div=%d, p=%d,q=%d, err1=%d, rslt=%d
\
r\
n
"
,
dev_dbg
(
sdev
,
"f=%d, div=%d, p=%d,q=%d, err1=%d, rslt=%d
\n
"
,
(
f0
*
(
pars
->
p
+
6
))
/
(
pars
->
q
+
2
)
/
pars
->
dv
,
(
f0
*
(
pars
->
p
+
6
))
/
(
pars
->
q
+
2
)
/
pars
->
dv
,
pars
->
dv
,
pars
->
dv
,
(
pars
->
p
+
6
),
(
pars
->
p
+
6
),
...
@@ -156,6 +156,7 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
...
@@ -156,6 +156,7 @@ int calc_pll_params (unsigned int f, t_pll_params * pars) { // f -in Hz
int
setCYField
(
int
sensor_port
,
int
reg_addr
,
int
mask
,
int
value
)
{
int
setCYField
(
int
sensor_port
,
int
reg_addr
,
int
mask
,
int
value
)
{
int
error
;
int
error
;
int
reg_data
;
int
reg_data
;
dev_dbg
(
sdev
,
"setCYField(%d, 0x%x, 0x%x,0x%x)
\n
"
,
sensor_port
,
reg_addr
,
mask
,
value
);
if
((
error
=
x393_xi2c_read_reg
(
CLOCK_NAME
,
// device class name
if
((
error
=
x393_xi2c_read_reg
(
CLOCK_NAME
,
// device class name
sensor_port
,
// sensor port number
sensor_port
,
// sensor port number
0
,
// slave address (7-bit) offset from the class defined slave address
0
,
// slave address (7-bit) offset from the class defined slave address
...
@@ -165,6 +166,7 @@ int setCYField (int sensor_port, int reg_addr, int mask, int value) {
...
@@ -165,6 +166,7 @@ int setCYField (int sensor_port, int reg_addr, int mask, int value) {
sensor_port
,
reg_addr
,
mask
,
value
);
sensor_port
,
reg_addr
,
mask
,
value
);
return
error
;
return
error
;
}
}
dev_dbg
(
sdev
,
"setCYField(%d, 0x%x, 0x%x,0x%x)=>0x%x
\n
"
,
sensor_port
,
reg_addr
,
mask
,
value
,
reg_data
);
reg_data
^=
(
reg_data
^
value
)
&
mask
;
reg_data
^=
(
reg_data
^
value
)
&
mask
;
if
((
error
=
x393_xi2c_write_reg
(
CLOCK_NAME
,
// device class name
if
((
error
=
x393_xi2c_write_reg
(
CLOCK_NAME
,
// device class name
sensor_port
,
// sensor port number
sensor_port
,
// sensor port number
...
@@ -181,22 +183,43 @@ int setCYField (int sensor_port, int reg_addr, int mask, int value) {
...
@@ -181,22 +183,43 @@ int setCYField (int sensor_port, int reg_addr, int mask, int value) {
int
x393_getClockFreq
(
int
sensor_port
,
int
nclock
)
{
int
x393_getClockFreq
(
int
sensor_port
,
int
nclock
)
{
if
((
sensor_port
<
0
)
||
(
sensor_port
>
3
)
||
(
nclock
<
0
)
||
(
nclock
>
3
))
return
-
EINVAL
;
// bad clock number
if
((
sensor_port
<
0
)
||
(
sensor_port
>
3
)
||
(
nclock
<
0
)
||
(
nclock
>
3
))
return
-
EINVAL
;
// bad clock number
else
{
else
{
return
clock_frequency
[(
sensor_port
<<
2
)
||
nclock
];
dev_dbg
(
sdev
,
"clock_frequency[%d]
\n
"
,(
sensor_port
<<
2
)
+
nclock
);
return
clock_frequency
[(
sensor_port
<<
2
)
+
nclock
];
}
}
}
}
EXPORT_SYMBOL_GPL
(
x393_getClockFreq
);
EXPORT_SYMBOL_GPL
(
x393_getClockFreq
);
int
x393_setClockFreq
(
int
sensor_port
,
int
nclock
,
int
freq
)
int
x393_setClockFreq
(
int
sensor_port
,
int
nclock
,
int
freq
)
{
// freq now in Hz
{
// freq now in Hz
int
err
=
0
;
int
err
=
0
;
int
i
,
bp
,
bq
,
bdiv
,
pllc
,
fact
;
t_pll_params
pll_params
;
sensor_port
&=
3
;
sensor_port
&=
3
;
nclock
&=
3
;
nclock
&=
3
;
t_pll_params
pll_params
;
int
i
,
bp
,
bq
,
bdiv
,
pllc
,
fact
;
bp
=
0
;
bq
=
0
;
bdiv
=
0
;
pllc
=
0
;
// just to make gcc happy
bp
=
0
;
bq
=
0
;
bdiv
=
0
;
pllc
=
0
;
// just to make gcc happy
fact
=
0
;
fact
=
0
;
dev_dbg
(
sdev
,
"setClockFreq(%d,%d,%d)
\r\n
"
,
sensor_port
,
nclock
,
freq
);
dev_dbg
(
sdev
,
"setClockFreq(%d,%d,%d)
\n
"
,
sensor_port
,
nclock
,
freq
);
// Just temporary debug:
#if 1
for
(
i
=
0
;
i
<
24
;
i
++
)
{
int
reg_data
;
// dev_dbg(sdev,"setCYField(%d, 0x%x, 0x%x,0x%x)\n",sensor_port, reg_addr, mask, value);
if
((
err
=
x393_xi2c_read_reg
(
CLOCK_NAME
,
// device class name
sensor_port
,
// sensor port number
0
,
// slave address (7-bit) offset from the class defined slave address
i
,
// register address (width is defined by class)
&
reg_data
))
<
0
)
{
// pointer to a data receiver (read data width is defined by class)
dev_err
(
sdev
,
"x393_xi2c_read_reg(%d, 0, 0x%x, 0x%x) failed reading i2c register
\n
"
,
sensor_port
,
i
,
reg_data
);
break
;
}
dev_err
(
sdev
,
"CY22393 port %d: [0x%x] => 0x%x
\n
"
,
sensor_port
,
i
,
reg_data
);
}
#endif
if
((
freq
!=
0
)
&&
(
nclock
!=
3
)
){
if
((
freq
!=
0
)
&&
(
nclock
!=
3
)
){
if
(
(
i
=
calc_pll_params
(
freq
,
&
pll_params
))
!=
0
)
{
if
(
(
i
=
calc_pll_params
(
freq
,
&
pll_params
))
!=
0
)
{
dev_err
(
sdev
,
"bad frequency for clock %d - %d Hz, err=%d
\n
"
,
nclock
,
freq
,
i
);
dev_err
(
sdev
,
"bad frequency for clock %d - %d Hz, err=%d
\n
"
,
nclock
,
freq
,
i
);
...
@@ -255,7 +278,7 @@ int x393_setClockFreq(int sensor_port, int nclock, int freq)
...
@@ -255,7 +278,7 @@ int x393_setClockFreq(int sensor_port, int nclock, int freq)
break
;
break
;
case
3
:
case
3
:
if
((
freq
!=
0
)
&&
(
freq
!=
CY22393_SCALE
*
CY22393_XTAL
))
{
if
((
freq
!=
0
)
&&
(
freq
!=
CY22393_SCALE
*
CY22393_XTAL
))
{
dev_err
(
sdev
,
"Only frequency 0 (off) and %d Hz (xtal) are allowed for channel 3
\
r\
n
"
,
CY22393_SCALE
*
CY22393_XTAL
);
dev_err
(
sdev
,
"Only frequency 0 (off) and %d Hz (xtal) are allowed for channel 3
\n
"
,
CY22393_SCALE
*
CY22393_XTAL
);
return
-
EINVAL
;
return
-
EINVAL
;
}
else
{
}
else
{
// int setCYField (sensor_port,int devfd, int addr, int mask, int value) O_RDWR
// int setCYField (sensor_port,int devfd, int addr, int mask, int value) O_RDWR
...
@@ -275,6 +298,7 @@ int x393_setClockFreq(int sensor_port, int nclock, int freq)
...
@@ -275,6 +298,7 @@ int x393_setClockFreq(int sensor_port, int nclock, int freq)
return
err
;
return
err
;
}
}
clock_frequency
[(
sensor_port
<<
2
)
+
nclock
]
=
fact
;
clock_frequency
[(
sensor_port
<<
2
)
+
nclock
]
=
fact
;
dev_dbg
(
sdev
,
"clock_frequency[%d]
\n
"
,(
sensor_port
<<
2
)
+
nclock
);
return
fact
;
return
fact
;
}
}
EXPORT_SYMBOL_GPL
(
x393_setClockFreq
);
EXPORT_SYMBOL_GPL
(
x393_setClockFreq
);
...
@@ -400,7 +424,7 @@ static void elphel393_clock10359_init_of(struct platform_device *pdev)
...
@@ -400,7 +424,7 @@ static void elphel393_clock10359_init_of(struct platform_device *pdev)
static
int
elphel393_clock10359_probe
(
struct
platform_device
*
pdev
)
static
int
elphel393_clock10359_probe
(
struct
platform_device
*
pdev
)
{
{
sdev
=&
pdev
->
dev
;
sdev
=&
pdev
->
dev
;
dev_
dbg
(
&
pdev
->
dev
,
"Probing elphel_clock10359
\n
"
);
dev_
info
(
&
pdev
->
dev
,
"Probing elphel_clock10359
\n
"
);
elphel393_clock10359_sysfs_register
(
pdev
);
elphel393_clock10359_sysfs_register
(
pdev
);
dev_dbg
(
&
pdev
->
dev
,
"elphel393_clock10359_sysfs_register() done
\n
"
);
dev_dbg
(
&
pdev
->
dev
,
"elphel393_clock10359_sysfs_register() done
\n
"
);
...
...
src/drivers/elphel/mt9x001.c
View file @
8b4b7b64
...
@@ -1219,7 +1219,7 @@ int mt9x001_pgm_limitfps (int sensor_port, ///< sensor port numb
...
@@ -1219,7 +1219,7 @@ int mt9x001_pgm_limitfps (int sensor_port, ///< sensor port numb
{
{
struct
frameparspair_t
pars_to_update
[
16
];
// maximum 7 registers updated (need to recount)
struct
frameparspair_t
pars_to_update
[
16
];
// maximum 7 registers updated (need to recount)
int
nupdate
=
0
;
int
nupdate
=
0
;
int
dh
=
thispars
->
pars
[
P_DCM_HOR
];
int
dh
=
thispars
->
pars
[
P_DCM_HOR
]
?
thispars
->
pars
[
P_DCM_HOR
]
:
1
;
int
ww
=
thispars
->
pars
[
P_SENSOR_PIXH
]
*
dh
;
int
ww
=
thispars
->
pars
[
P_SENSOR_PIXH
]
*
dh
;
int
binning_cost
=
0
;
int
binning_cost
=
0
;
int
width
,
i
;
int
width
,
i
;
...
...
src/drivers/elphel/multi10359.c
View file @
8b4b7b64
This diff is collapsed.
Click to expand it.
src/drivers/elphel/multi10359.h
View file @
8b4b7b64
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
//#define I2C359_I2CMUX 0x07
//#define I2C359_I2CMUX 0x07
// #define I2C359_I2CMUX_2MEM 0x1
// #define I2C359_I2CMUX_2MEM 0x1
// #define I2C359_I2CMUX_2SENSORS 0x0
// #define I2C359_I2CMUX_2SENSORS 0x0
#define I2C359_CLKSRC 0x08 ///< register address: clock source
#define I2C359_CLKSRC 0x08 ///< register address: clock source
// does not read back
#define I2C359_CLKSRC_SYSTEM 0x00 ///< clock source: system (from the system board over)
#define I2C359_CLKSRC_SYSTEM 0x00 ///< clock source: system (from the system board over)
#define I2C359_CLKSRC_LOCAL 0x01 ///< clock source: local (clock generator on the 10359 board
#define I2C359_CLKSRC_LOCAL 0x01 ///< clock source: local (clock generator on the 10359 board
#define I2C359_MODE 0x09 ///< register address: mode register
#define I2C359_MODE 0x09 ///< register address: mode register
...
...
src/drivers/elphel/pgm_functions.c
View file @
8b4b7b64
...
@@ -1096,6 +1096,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
...
@@ -1096,6 +1096,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
}
}
// dh (decimation changed)?
// dh (decimation changed)?
dh
=
thispars
->
pars
[
P_DCM_HOR
];
dh
=
thispars
->
pars
[
P_DCM_HOR
];
dh
=
dh
?
dh
:
1
;
if
(
FRAMEPAR_MODIFIED
(
P_DCM_HOR
))
{
if
(
FRAMEPAR_MODIFIED
(
P_DCM_HOR
))
{
if
(
dh
<
1
)
dh
=
1
;
else
if
(
dh
>
32
)
dh
=
32
;
if
(
dh
<
1
)
dh
=
1
;
else
if
(
dh
>
32
)
dh
=
32
;
while
((
dh
>
1
)
&&
!
(
sensor
->
dcmHor
&
(
1
<<
(
dh
-
1
))))
dh
--
;
// adjust decimation to maximal supported (if requested is not supported)
while
((
dh
>
1
)
&&
!
(
sensor
->
dcmHor
&
(
1
<<
(
dh
-
1
))))
dh
--
;
// adjust decimation to maximal supported (if requested is not supported)
...
@@ -1103,6 +1104,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
...
@@ -1103,6 +1104,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
}
}
// dv (decimation changed)?
// dv (decimation changed)?
dv
=
thispars
->
pars
[
P_DCM_VERT
];
dv
=
thispars
->
pars
[
P_DCM_VERT
];
dv
=
dv
?
dv
:
1
;
if
(
FRAMEPAR_MODIFIED
(
P_DCM_VERT
))
{
if
(
FRAMEPAR_MODIFIED
(
P_DCM_VERT
))
{
if
(
dv
<
1
)
dv
=
1
;
else
if
(
dv
>
32
)
dv
=
32
;
if
(
dv
<
1
)
dv
=
1
;
else
if
(
dv
>
32
)
dv
=
32
;
while
((
dv
>
1
)
&&
!
(
sensor
->
dcmVert
&
(
1
<<
(
dv
-
1
))))
dv
--
;
// adjust decimation to maximal supported (if requested is not supported)
while
((
dv
>
1
)
&&
!
(
sensor
->
dcmVert
&
(
1
<<
(
dv
-
1
))))
dv
--
;
// adjust decimation to maximal supported (if requested is not supported)
...
@@ -1110,6 +1112,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
...
@@ -1110,6 +1112,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
}
}
// bh (binning changed)?
// bh (binning changed)?
bh
=
thispars
->
pars
[
P_BIN_HOR
];
bh
=
thispars
->
pars
[
P_BIN_HOR
];
dv
=
dv
?
dv
:
1
;
if
(
FRAMEPAR_MODIFIED
(
P_BIN_HOR
))
{
if
(
FRAMEPAR_MODIFIED
(
P_BIN_HOR
))
{
if
(
bh
<
1
)
bh
=
1
;
else
if
(
bh
>
dh
)
bh
=
dh
;
if
(
bh
<
1
)
bh
=
1
;
else
if
(
bh
>
dh
)
bh
=
dh
;
while
((
bh
>
1
)
&&
!
(
sensor
->
binHor
&
(
1
<<
(
bh
-
1
))))
bh
--
;
// adjust binning to maximal supported (if requested is not supported)
while
((
bh
>
1
)
&&
!
(
sensor
->
binHor
&
(
1
<<
(
bh
-
1
))))
bh
--
;
// adjust binning to maximal supported (if requested is not supported)
...
@@ -1117,6 +1120,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
...
@@ -1117,6 +1120,7 @@ int pgm_window_common (int sensor_port, ///< sensor port number (
}
}
// bv (binning changed)?
// bv (binning changed)?
bv
=
thispars
->
pars
[
P_BIN_VERT
];
bv
=
thispars
->
pars
[
P_BIN_VERT
];
bv
=
bv
?
bv
:
1
;
if
(
FRAMEPAR_MODIFIED
(
P_BIN_VERT
))
{
if
(
FRAMEPAR_MODIFIED
(
P_BIN_VERT
))
{
if
(
bv
<
1
)
bv
=
1
;
else
if
(
bv
>
dv
)
bv
=
dv
;
if
(
bv
<
1
)
bv
=
1
;
else
if
(
bv
>
dv
)
bv
=
dv
;
while
((
bv
>
1
)
&&
!
(
sensor
->
binVert
&
(
1
<<
(
bv
-
1
))))
bv
--
;
// adjust binning to maximal supported (if requested is not supported)
while
((
bv
>
1
)
&&
!
(
sensor
->
binVert
&
(
1
<<
(
bv
-
1
))))
bv
--
;
// adjust binning to maximal supported (if requested is not supported)
...
...
src/drivers/elphel/sensor_common.c
View file @
8b4b7b64
...
@@ -1141,16 +1141,21 @@ int legacy_i2c(int ports) ///< bitmask of the sensor ports to use
...
@@ -1141,16 +1141,21 @@ int legacy_i2c(int ports) ///< bitmask of the sensor ports to use
for
(
sensor_port
=
0
;
sensor_port
<
SENSOR_PORTS
;
sensor_port
++
)
if
(
ports
&
(
1
<<
sensor_port
))
{
for
(
sensor_port
=
0
;
sensor_port
<
SENSOR_PORTS
;
sensor_port
++
)
if
(
ports
&
(
1
<<
sensor_port
))
{
i2c_page_alloc_init
(
sensor_port
);
// reset all pages allocation
i2c_page_alloc_init
(
sensor_port
);
// reset all pages allocation
i2c_page_register
(
sensor_port
,
class_10359
->
slave7
);
i2c_page_register
(
sensor_port
,
class_10359
->
slave7
);
dev_dbg
(
g_dev_ptr
,
"Reset previously allocated pages for port= %d
\n
"
,
sensor_port
);
dev_dbg
(
g_dev_ptr
,
"Setting 10359 page for port %d, slave= 0x%x
\n
"
,
sensor_port
,
class_10359
->
slave7
);
set_xi2c_wrc
(
class_10359
,
sensor_port
,
class_10359
->
slave7
,
0
);
set_xi2c_wrc
(
class_10359
,
sensor_port
,
class_10359
->
slave7
,
0
);
for
(
subchn
=
0
;
subchn
<
4
;
subchn
++
){
// subchn == 0 - broadcast
for
(
subchn
=
0
;
subchn
<
4
;
subchn
++
){
// subchn == 0 - broadcast
dev_sensor
.
slave7
=
class_sensor
->
slave7
+
I2C359_INC
*
subchn
;
dev_sensor
.
slave7
=
class_sensor
->
slave7
+
I2C359_INC
*
subchn
;
dev_dbg
(
g_dev_ptr
,
"Setting sensor page for port %d, slave= 0x%x
\n
"
,
sensor_port
,
dev_sensor
.
slave7
);
i2c_page_register
(
sensor_port
,
dev_sensor
.
slave7
);
i2c_page_register
(
sensor_port
,
dev_sensor
.
slave7
);
set_xi2c_wrc
(
&
dev_sensor
,
sensor_port
,
dev_sensor
.
slave7
,
0
);
set_xi2c_wrc
(
&
dev_sensor
,
sensor_port
,
dev_sensor
.
slave7
,
0
);
}
}
// Now register one page for reading 10359 and the sensor using sensor speed data
// Now register one page for reading 10359 and the sensor using sensor speed data
memcpy
(
&
dev_sensor
,
class_sensor
,
sizeof
(
x393_i2c_device_t
));
// dev_sensor));
memcpy
(
&
dev_sensor
,
class_sensor
,
sizeof
(
x393_i2c_device_t
));
// dev_sensor));
dev_dbg
(
g_dev_ptr
,
"Registering page to read senors 16-bit on port %d, page= 0x%x
\n
"
,
sensor_port
,
LEGACY_READ_PAGE2
);
i2c_page_register
(
sensor_port
,
LEGACY_READ_PAGE2
);
i2c_page_register
(
sensor_port
,
LEGACY_READ_PAGE2
);
set_xi2c_rdc
(
&
dev_sensor
,
sensor_port
,
LEGACY_READ_PAGE2
);
set_xi2c_rdc
(
&
dev_sensor
,
sensor_port
,
LEGACY_READ_PAGE2
);
dev_dbg
(
g_dev_ptr
,
"Registering page to read 32-bit data for 10359 on port %d, page= 0x%x
\n
"
,
sensor_port
,
LEGACY_READ_PAGE4
);
i2c_page_register
(
sensor_port
,
LEGACY_READ_PAGE4
);
i2c_page_register
(
sensor_port
,
LEGACY_READ_PAGE4
);
dev_sensor
.
data_bytes
=
4
;
// for reading 10359 in 32-bit mode
dev_sensor
.
data_bytes
=
4
;
// for reading 10359 in 32-bit mode
set_xi2c_rdc
(
&
dev_sensor
,
sensor_port
,
LEGACY_READ_PAGE4
);
set_xi2c_rdc
(
&
dev_sensor
,
sensor_port
,
LEGACY_READ_PAGE4
);
...
...
src/drivers/elphel/sensor_i2c.c
View file @
8b4b7b64
This diff is collapsed.
Click to expand it.
src/drivers/elphel/sensor_i2c.h
View file @
8b4b7b64
...
@@ -42,7 +42,7 @@ int read_xi2c_frame (int chn);
...
@@ -42,7 +42,7 @@ int read_xi2c_frame (int chn);
int
i2c_page_alloc
(
int
chn
);
int
i2c_page_alloc
(
int
chn
);
int
i2c_page_register
(
int
chn
,
int
page
);
int
i2c_page_register
(
int
chn
,
int
page
);
void
i2c_page_free
(
int
chn
,
int
page
);
void
i2c_page_free
(
int
chn
,
int
page
);
x393_i2c_device_t
*
xi2c_dev_get
(
const
char
*
name
);
//
x393_i2c_device_t * xi2c_dev_get(const char * name);
void
set_xi2c_raw
(
int
chn
,
int
page
,
u32
data
);
void
set_xi2c_raw
(
int
chn
,
int
page
,
u32
data
);
void
set_xi2c_wr
(
int
chn
,
int
page
,
int
sa7
,
int
rah
,
int
num_bytes
,
int
bit_delay
);
void
set_xi2c_wr
(
int
chn
,
int
page
,
int
sa7
,
int
rah
,
int
num_bytes
,
int
bit_delay
);
void
set_xi2c_wrc
(
x393_i2c_device_t
*
dc
,
int
chn
,
int
page
,
int
rah
);
void
set_xi2c_wrc
(
x393_i2c_device_t
*
dc
,
int
chn
,
int
page
,
int
rah
);
...
@@ -60,5 +60,13 @@ int read_xi2c_fifo (int chn);
...
@@ -60,5 +60,13 @@ int read_xi2c_fifo (int chn);
x393_i2c_device_t
*
xi2c_dev_get
(
const
char
*
name
);
x393_i2c_device_t
*
xi2c_dev_get
(
const
char
*
name
);
int
x393_xi2c_write_reg
(
const
char
*
cname
,
int
chn
,
int
sa7_offs
,
int
reg_addr
,
int
data
);
int
x393_xi2c_write_reg
(
const
char
*
cname
,
int
chn
,
int
sa7_offs
,
int
reg_addr
,
int
data
);
int
x393_xi2c_read_reg
(
const
char
*
cname
,
int
chn
,
int
sa7_offs
,
int
reg_addr
,
int
*
datap
);
int
x393_xi2c_read_reg
(
const
char
*
cname
,
int
chn
,
int
sa7_offs
,
int
reg_addr
,
int
*
datap
);
int
x393_xi2c_ready_wr
(
int
chn
);
int
x393_xi2c_wait_wr
(
int
chn
);
int
legacy_read_i2c_reg
(
int
chn
,
int
page
,
int
sa7
,
int
reg_addr
,
int
len
,
int
*
datap
);
int
legacy_read_i2c_reg
(
int
chn
,
int
page
,
int
sa7
,
int
reg_addr
,
int
len
,
int
*
datap
);
int
i2c_get_max_unbalanced_writes
(
void
);
void
reset_unbalanced_writes
(
int
chn
);
void
inc_unbalanced_writes
(
int
chn
);
int
check_unbalanced_writes
(
int
chn
);
int
get_unbalanced_writes
(
int
chn
);
#endif
#endif
src/drivers/elphel/x393_videomem.c
View file @
8b4b7b64
...
@@ -213,7 +213,7 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
...
@@ -213,7 +213,7 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
int
frame_full_width
=
buffer_settings
.
frame_full_width
[
num_sensor
]
>>
4
;
int
frame_full_width
=
buffer_settings
.
frame_full_width
[
num_sensor
]
>>
4
;
int
frame_sa_inc
=
frame_full_width
*
(
buffer_settings
.
frame_height
[
num_sensor
]
>>
3
);
int
frame_sa_inc
=
frame_full_width
*
(
buffer_settings
.
frame_height
[
num_sensor
]
>>
3
);
int
last_frame_num
=
buffer_settings
.
frames_in_buffer
[
num_sensor
]
-
1
;
int
last_frame_num
=
buffer_settings
.
frames_in_buffer
[
num_sensor
]
-
1
;
int
byte32
=
1
;
///< 1 - 32-byte columns (currently used), 0 - 16 byte columns
//
int byte32 = 1; ///< 1 - 32-byte columns (currently used), 0 - 16 byte columns
x393_mcntrl_window_frame_sa_t
window_frame_sa
=
{.
d32
=
0
};
x393_mcntrl_window_frame_sa_t
window_frame_sa
=
{.
d32
=
0
};
x393_mcntrl_window_frame_sa_inc_t
window_frame_sa_inc
=
{.
d32
=
0
};
x393_mcntrl_window_frame_sa_inc_t
window_frame_sa_inc
=
{.
d32
=
0
};
...
@@ -554,7 +554,7 @@ static int videomem_probe(struct platform_device *pdev)
...
@@ -554,7 +554,7 @@ static int videomem_probe(struct platform_device *pdev)
int
res
;
int
res
;
struct
device
*
dev
=
&
pdev
->
dev
;
struct
device
*
dev
=
&
pdev
->
dev
;
const
struct
of_device_id
*
match
;
const
struct
of_device_id
*
match
;
const
__be32
*
bufsize_be
;
//
const __be32 *bufsize_be;
struct
device_node
*
node
;
struct
device_node
*
node
;
elphel393_videomem_sysfs_register
(
pdev
);
elphel393_videomem_sysfs_register
(
pdev
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment