BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
741ac74d
Commit
741ac74d
authored
Nov 05, 2018
by
Ashish Syal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated with working version of expander
parent
4160cb4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
26 deletions
+37
-26
expander.c
linux_kernel_modules/expander/expander.c
+36
-25
expander.mdef
linux_kernel_modules/expander/expander.mdef
+1
-1
No files found.
linux_kernel_modules/expander/expander.c
View file @
741ac74d
...
...
@@ -50,6 +50,7 @@ static int _var##_store(struct device *dev, \
\
gpio_set_value_cansleep(exp->gpio_expander_base + _offset, val); \
atomic_set(&exp->_var##_val, val); \
dev_info(dev, "Setting GPIO %d to %d\n", exp->gpio_expander_base + _offset, val); \
\
return count; \
} \
...
...
@@ -70,18 +71,25 @@ static void gpio_initial_status(struct platform_device *pdev,
atomic_t
*
atomic_val
)
{
struct
expander_device
*
exp
=
dev_get_drvdata
(
&
pdev
->
dev
);
devm_gpio_request
(
&
pdev
->
dev
,
exp
->
gpio_expander_base
+
function_number
,
//struct expander_device* exp = dev_get_drvdata(&pdev->dev);
dev_info
(
&
pdev
->
dev
,
"%s(): initial_status
\n
"
,
__func__
);
devm_gpio_request
(
&
pdev
->
dev
,
function_number
,
dev_name
(
&
pdev
->
dev
));
atomic_set
(
atomic_val
,
function_val
);
dev_info
(
&
pdev
->
dev
,
"%s(): initial_status_line2
\n
"
,
__func__
);
atomic_set
(
atomic_val
,
function_val
);
dev_info
(
&
pdev
->
dev
,
"%s(): initial_status_line3
\n
"
,
__func__
);
gpio_direction_output
(
exp
->
gpio_expander_base
+
function_number
,
gpio_direction_output
(
function_number
,
function_val
);
dev_info
(
&
pdev
->
dev
,
"%s(): initial_status_line4
\n
"
,
__func__
);
device_create_file
(
&
pdev
->
dev
,
attr
);
dev_info
(
&
pdev
->
dev
,
"%s(): initial_status_line5
\n
"
,
__func__
);
}
...
...
@@ -91,12 +99,15 @@ static void gpio_final_status(struct platform_device *pdev,
int
function_number
,
int
function_val
)
{
struct
expander_device
*
exp
=
dev_get_drvdata
(
&
pdev
->
dev
);
dev_info
(
&
pdev
->
dev
,
"%s(): final_status
\n
"
,
__func__
);
device_remove_file
(
&
pdev
->
dev
,
attr
);
dev_info
(
&
pdev
->
dev
,
"%s(): final_status_line2
\n
"
,
__func__
);
gpio_set_value_cansleep
(
exp
->
gpio_expander_base
+
function_number
,
function_val
);
gpio_set_value_cansleep
(
function_number
,
function_val
);
dev_info
(
&
pdev
->
dev
,
"%s(): final_status_line3
\n
"
,
__func__
);
}
...
...
@@ -107,6 +118,7 @@ static int expander_probe(struct platform_device *pdev)
{
struct
expander_device
*
dev
;
int
ret
=
0
;
//int *pass = NULL;
struct
expander_platform_data
*
pdata
=
dev_get_platdata
(
&
pdev
->
dev
);
dev_info
(
&
pdev
->
dev
,
"%s(): probe
\n
"
,
__func__
);
...
...
@@ -127,14 +139,13 @@ static int expander_probe(struct platform_device *pdev)
dev
->
pdev
=
pdev
;
dev
->
gpio_expander_base
=
pdata
->
gpio_expander_base
;
gpio_initial_status
(
pdev
,
&
dev_attr_generic_led
,
GENERIC_LED
,
0
,
&
dev
->
generic_led_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_pcm_sel
,
PCM_SEL
,
0
,
&
dev
->
pcm_sel_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_sdio_sel
,
SDIO_SEL
,
0
,
&
dev
->
sdio_sel_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_tri_led_blu
,
TRI_LED_BLU
,
0
,
&
dev
->
tri_led_blu_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_tri_led_red
,
TRI_LED_RED
,
0
,
&
dev
->
tri_led_red_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_tri_led_grn
,
TRI_LED_GRN
,
0
,
&
dev
->
tri_led_grn_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_buzzer
,
BUZZER
,
0
,
&
dev
->
buzzer_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_generic_led
,
dev
->
gpio_expander_base
+
GENERIC_LED
,
0
,
&
dev
->
generic_led_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_pcm_sel
,
dev
->
gpio_expander_base
+
PCM_SEL
,
0
,
&
dev
->
pcm_sel_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_sdio_sel
,
dev
->
gpio_expander_base
+
SDIO_SEL
,
0
,
&
dev
->
sdio_sel_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_tri_led_blu
,
dev
->
gpio_expander_base
+
TRI_LED_BLU
,
0
,
&
dev
->
tri_led_blu_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_tri_led_red
,
dev
->
gpio_expander_base
+
TRI_LED_RED
,
0
,
&
dev
->
tri_led_red_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_tri_led_grn
,
dev
->
gpio_expander_base
+
TRI_LED_GRN
,
0
,
&
dev
->
tri_led_grn_val
);
gpio_initial_status
(
pdev
,
&
dev_attr_buzzer
,
dev
->
gpio_expander_base
+
BUZZER
,
0
,
&
dev
->
buzzer_val
);
platform_set_drvdata
(
pdev
,
dev
);
...
...
@@ -144,17 +155,17 @@ done:
static
int
expander_remove
(
struct
platform_device
*
pdev
)
{
// struct expander_device* dev = dev_get_drvdata(&pdev->dev);
dev_info
(
&
pdev
->
dev
,
"%s(): remove
\n
"
,
__func__
);
struct
expander_device
*
dev
=
dev_get_drvdata
(
&
pdev
->
dev
);
/* remove sysfs files & set final state values for gpio expander*/
gpio_final_status
(
pdev
,
&
dev_attr_generic_led
,
GENERIC_LED
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_pcm_sel
,
PCM_SEL
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_sdio_sel
,
SDIO_SEL
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_tri_led_blu
,
TRI_LED_BLU
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_tri_led_red
,
TRI_LED_RED
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_tri_led_grn
,
TRI_LED_GRN
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_buzzer
,
BUZZER
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_generic_led
,
dev
->
gpio_expander_base
+
GENERIC_LED
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_pcm_sel
,
dev
->
gpio_expander_base
+
PCM_SEL
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_sdio_sel
,
dev
->
gpio_expander_base
+
SDIO_SEL
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_tri_led_blu
,
dev
->
gpio_expander_base
+
TRI_LED_BLU
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_tri_led_red
,
dev
->
gpio_expander_base
+
TRI_LED_RED
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_tri_led_grn
,
dev
->
gpio_expander_base
+
TRI_LED_GRN
,
0
);
gpio_final_status
(
pdev
,
&
dev_attr_buzzer
,
dev
->
gpio_expander_base
+
BUZZER
,
0
);
return
0
;
}
...
...
linux_kernel_modules/expander/expander.mdef
View file @
741ac74d
...
...
@@ -5,7 +5,7 @@ sources:
cflags:
{
//
-DDEBUG
-DDEBUG
}
params:
...
...
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