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
993a1242
Commit
993a1242
authored
May 17, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a kp when w/o 10389
parent
7235a848
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
19 deletions
+42
-19
elphel393-pwr.c
src/drivers/elphel/elphel393-pwr.c
+42
-19
No files found.
src/drivers/elphel/elphel393-pwr.c
View file @
993a1242
...
@@ -1207,6 +1207,8 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
...
@@ -1207,6 +1207,8 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
struct
i2c_client
*
ltc3589_client
;
struct
i2c_client
*
ltc3589_client
;
struct
elphel393_pwr_data_t
*
clientdata
=
NULL
;
struct
elphel393_pwr_data_t
*
clientdata
=
NULL
;
struct
gpio_desc
*
desc
;
shutdown_dev
=
&
pdev
->
dev
;
shutdown_dev
=
&
pdev
->
dev
;
dev_info
(
&
pdev
->
dev
,
"Probing elphel393-pwr
\n
"
);
dev_info
(
&
pdev
->
dev
,
"Probing elphel393-pwr
\n
"
);
...
@@ -1228,10 +1230,16 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
...
@@ -1228,10 +1230,16 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
/* locate GPIO chips by i2c address */
/* locate GPIO chips by i2c address */
for
(
i
=
0
;
i
<
3
;
i
++
){
for
(
i
=
0
;
i
<
3
;
i
++
){
chip
=
gpiochip_find
(
&
clientdata
->
chip_i2c_addr
[
i
],
i2c_addr_gpiochip_match
);
chip
=
gpiochip_find
(
&
clientdata
->
chip_i2c_addr
[
i
],
i2c_addr_gpiochip_match
);
if
(
chip
!=
NULL
)
{
base
[
i
]
=
chip
->
base
;
base
[
i
]
=
chip
->
base
;
dev_dbg
(
&
pdev
->
dev
,
"Found gpio_chip with i2c_addr=0x%02x, label=%s, base=0x%x
\n
"
,
clientdata
->
chip_i2c_addr
[
i
],
chip
->
label
,
base
[
i
]);
dev_dbg
(
&
pdev
->
dev
,
"Found gpio_chip with i2c_addr=0x%02x, label=%s, base=0x%x
\n
"
,
clientdata
->
chip_i2c_addr
[
i
],
chip
->
label
,
base
[
i
]);
}
else
{
base
[
i
]
=
NULL
;
}
}
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
pwr_gpio
);
i
++
)
if
(
pwr_gpio
[
i
].
label
){
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
pwr_gpio
);
i
++
){
if
(
base
[
i
>>
3
]
!=
NULL
)
if
(
pwr_gpio
[
i
].
label
){
clientdata
->
pwr_gpio
[
i
].
label
=
pwr_gpio
[
i
].
label
;
clientdata
->
pwr_gpio
[
i
].
label
=
pwr_gpio
[
i
].
label
;
clientdata
->
pwr_gpio
[
i
].
pin
=
base
[
i
>>
3
]
+
(
i
&
7
);
clientdata
->
pwr_gpio
[
i
].
pin
=
base
[
i
>>
3
]
+
(
i
&
7
);
...
@@ -1249,6 +1257,19 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
...
@@ -1249,6 +1257,19 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
return
rc
;
return
rc
;
}
else
{
}
else
{
dev_dbg
(
&
pdev
->
dev
,
"Confirmed request GPIO[%d] with label %s
\n
"
,
clientdata
->
pwr_gpio
[
i
].
pin
,
clientdata
->
pwr_gpio
[
i
].
label
);
dev_dbg
(
&
pdev
->
dev
,
"Confirmed request GPIO[%d] with label %s
\n
"
,
clientdata
->
pwr_gpio
[
i
].
pin
,
clientdata
->
pwr_gpio
[
i
].
label
);
}
//now try to read and update the structure
//gpiod_direction_output_raw(gpio_to_desc(gpio), value);
//desc = gpio_to_desc(base[i>>3]+(i & 7));
//rc = gpiod_get_direction(desc);
//pr_info("the %d direction is %d\n",i,rc);
//clientdata->ltc3489_dev=find_device_by_i2c_addr(clientdata->chip_i2c_addr[i>>3]);
//ltc3589_client = to_i2c_client(clientdata->ltc3489_dev);
//pr_info("read %d from i2c: %d\n",i,ltc3589_read_field(ltc3589_client, 0x3));
}
}
}
}
...
@@ -1270,9 +1291,11 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
...
@@ -1270,9 +1291,11 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
*/
*/
pm_power_off
=
shutdown
;
pm_power_off
=
shutdown
;
if
(
base
[
2
]
!=
NULL
){
//turn off PCA9571
//turn off PCA9571
gpio_10389_ctrl
(
&
pdev
->
dev
,
0xf0f
);
gpio_10389_ctrl
(
&
pdev
->
dev
,
0xf0f
);
gpio_10389_ctrl
(
&
pdev
->
dev
,
0xf00
);
gpio_10389_ctrl
(
&
pdev
->
dev
,
0xf00
);
}
return
0
;
return
0
;
}
}
...
...
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