Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
772c0cf1
Commit
772c0cf1
authored
Nov 20, 2002
by
Andy Grover
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ACPI: Add ec_read and ec_write external functions
Other ec.c cleanups, too
parent
f6321f7d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
66 deletions
+116
-66
drivers/acpi/acpi_ksyms.c
drivers/acpi/acpi_ksyms.c
+9
-0
drivers/acpi/ec.c
drivers/acpi/ec.c
+101
-66
include/linux/acpi.h
include/linux/acpi.h
+6
-0
No files found.
drivers/acpi/acpi_ksyms.c
View file @
772c0cf1
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*/
*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/acpi.h>
#include "include/acpi.h"
#include "include/acpi.h"
#include "acpi_bus.h"
#include "acpi_bus.h"
...
@@ -141,3 +142,11 @@ EXPORT_SYMBOL(acpi_pci_irq_enable);
...
@@ -141,3 +142,11 @@ EXPORT_SYMBOL(acpi_pci_irq_enable);
extern
int
acpi_pci_irq_lookup
(
int
segment
,
int
bus
,
int
device
,
int
pin
);
extern
int
acpi_pci_irq_lookup
(
int
segment
,
int
bus
,
int
device
,
int
pin
);
EXPORT_SYMBOL
(
acpi_pci_irq_lookup
);
EXPORT_SYMBOL
(
acpi_pci_irq_lookup
);
#endif
/*CONFIG_ACPI_PCI */
#endif
/*CONFIG_ACPI_PCI */
#ifdef CONFIG_ACPI_EC
/* ACPI EC driver (ec.c) */
EXPORT_SYMBOL
(
ec_read
);
EXPORT_SYMBOL
(
ec_write
);
#endif
drivers/acpi/ec.c
View file @
772c0cf1
...
@@ -92,6 +92,9 @@ struct acpi_ec {
...
@@ -92,6 +92,9 @@ struct acpi_ec {
/* If we find an EC via the ECDT, we need to keep a ptr to its context */
/* If we find an EC via the ECDT, we need to keep a ptr to its context */
static
struct
acpi_ec
*
ec_ecdt
;
static
struct
acpi_ec
*
ec_ecdt
;
/* External interfaces use first EC only, so remember */
static
struct
acpi_device
*
first_ec
;
/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
Transaction Management
Transaction Management
-------------------------------------------------------------------------- */
-------------------------------------------------------------------------- */
...
@@ -236,6 +239,47 @@ acpi_ec_write (
...
@@ -236,6 +239,47 @@ acpi_ec_write (
return_VALUE
(
result
);
return_VALUE
(
result
);
}
}
/*
* Externally callable EC access functions. For now, assume 1 EC only
*/
int
ec_read
(
u8
addr
,
u8
*
val
)
{
struct
acpi_ec
*
ec
;
int
err
;
u32
temp_data
;
if
(
!
first_ec
)
return
-
ENODEV
;
ec
=
acpi_driver_data
(
first_ec
);
err
=
acpi_ec_read
(
ec
,
addr
,
&
temp_data
);
if
(
!
err
)
{
*
val
=
temp_data
;
return
0
;
}
else
return
err
;
}
int
ec_write
(
u8
addr
,
u8
val
)
{
struct
acpi_ec
*
ec
;
int
err
;
if
(
!
first_ec
)
return
-
ENODEV
;
ec
=
acpi_driver_data
(
first_ec
);
err
=
acpi_ec_write
(
ec
,
addr
,
val
);
return
err
;
}
static
int
static
int
acpi_ec_query
(
acpi_ec_query
(
...
@@ -540,11 +584,15 @@ acpi_ec_add (
...
@@ -540,11 +584,15 @@ acpi_ec_add (
acpi_evaluate_integer
(
ec
->
handle
,
"_GLK"
,
NULL
,
&
ec
->
global_lock
);
acpi_evaluate_integer
(
ec
->
handle
,
"_GLK"
,
NULL
,
&
ec
->
global_lock
);
/* If our UID matches the UID for the ECDT-enumerated EC,
/* If our UID matches the UID for the ECDT-enumerated EC,
we
already found this EC, so abort.
*/
we
now have the *real* EC info, so kill the makeshift one.
*/
acpi_evaluate_integer
(
ec
->
handle
,
"_UID"
,
NULL
,
&
uid
);
acpi_evaluate_integer
(
ec
->
handle
,
"_UID"
,
NULL
,
&
uid
);
if
(
ec_ecdt
&&
ec_ecdt
->
uid
==
uid
)
{
if
(
ec_ecdt
&&
ec_ecdt
->
uid
==
uid
)
{
result
=
-
ENODEV
;
acpi_remove_address_space_handler
(
ACPI_ROOT_OBJECT
,
goto
end
;
ACPI_ADR_SPACE_EC
,
&
acpi_ec_space_handler
);
acpi_remove_gpe_handler
(
ec_ecdt
->
gpe_bit
,
&
acpi_ec_gpe_handler
);
kfree
(
ec_ecdt
);
}
}
/* Get GPE bit assignment (EC events). */
/* Get GPE bit assignment (EC events). */
...
@@ -564,6 +612,9 @@ acpi_ec_add (
...
@@ -564,6 +612,9 @@ acpi_ec_add (
acpi_device_name
(
device
),
acpi_device_bid
(
device
),
acpi_device_name
(
device
),
acpi_device_bid
(
device
),
(
u32
)
ec
->
gpe_bit
);
(
u32
)
ec
->
gpe_bit
);
if
(
!
first_ec
)
first_ec
=
device
;
end:
end:
if
(
result
)
if
(
result
)
kfree
(
ec
);
kfree
(
ec
);
...
@@ -584,7 +635,7 @@ acpi_ec_remove (
...
@@ -584,7 +635,7 @@ acpi_ec_remove (
if
(
!
device
)
if
(
!
device
)
return_VALUE
(
-
EINVAL
);
return_VALUE
(
-
EINVAL
);
ec
=
(
struct
acpi_ec
*
)
acpi_driver_data
(
device
);
ec
=
acpi_driver_data
(
device
);
acpi_ec_remove_fs
(
device
);
acpi_ec_remove_fs
(
device
);
...
@@ -609,7 +660,7 @@ acpi_ec_start (
...
@@ -609,7 +660,7 @@ acpi_ec_start (
if
(
!
device
)
if
(
!
device
)
return_VALUE
(
-
EINVAL
);
return_VALUE
(
-
EINVAL
);
ec
=
(
struct
acpi_ec
*
)
acpi_driver_data
(
device
);
ec
=
acpi_driver_data
(
device
);
if
(
!
ec
)
if
(
!
ec
)
return_VALUE
(
-
EINVAL
);
return_VALUE
(
-
EINVAL
);
...
@@ -688,7 +739,7 @@ acpi_ec_stop (
...
@@ -688,7 +739,7 @@ acpi_ec_stop (
if
(
!
device
)
if
(
!
device
)
return_VALUE
(
-
EINVAL
);
return_VALUE
(
-
EINVAL
);
ec
=
(
struct
acpi_ec
*
)
acpi_driver_data
(
device
);
ec
=
acpi_driver_data
(
device
);
status
=
acpi_remove_address_space_handler
(
ec
->
handle
,
status
=
acpi_remove_address_space_handler
(
ec
->
handle
,
ACPI_ADR_SPACE_EC
,
&
acpi_ec_space_handler
);
ACPI_ADR_SPACE_EC
,
&
acpi_ec_space_handler
);
...
@@ -711,12 +762,13 @@ acpi_ec_ecdt_probe (void)
...
@@ -711,12 +762,13 @@ acpi_ec_ecdt_probe (void)
status
=
acpi_get_firmware_table
(
"ECDT"
,
1
,
ACPI_LOGICAL_ADDRESSING
,
status
=
acpi_get_firmware_table
(
"ECDT"
,
1
,
ACPI_LOGICAL_ADDRESSING
,
(
acpi_table_header
**
)
&
ecdt_ptr
);
(
acpi_table_header
**
)
&
ecdt_ptr
);
if
(
ACPI_SUCCESS
(
status
))
{
if
(
ACPI_FAILURE
(
status
))
return
0
;
printk
(
KERN_INFO
PREFIX
"Found ECDT
\n
"
);
printk
(
KERN_INFO
PREFIX
"Found ECDT
\n
"
);
/*
/*
* TODO: When the new driver model allows it, simply tell the
* Generate a temporary ec context to use until the namespace is scanned
* EC driver it has a new device via that, instead if this.
*/
*/
ec_ecdt
=
kmalloc
(
sizeof
(
struct
acpi_ec
),
GFP_KERNEL
);
ec_ecdt
=
kmalloc
(
sizeof
(
struct
acpi_ec
),
GFP_KERNEL
);
if
(
!
ec_ecdt
)
if
(
!
ec_ecdt
)
...
@@ -755,7 +807,6 @@ acpi_ec_ecdt_probe (void)
...
@@ -755,7 +807,6 @@ acpi_ec_ecdt_probe (void)
&
acpi_ec_gpe_handler
);
&
acpi_ec_gpe_handler
);
goto
error
;
goto
error
;
}
}
}
return
0
;
return
0
;
...
@@ -795,20 +846,6 @@ subsys_initcall(acpi_ec_init);
...
@@ -795,20 +846,6 @@ subsys_initcall(acpi_ec_init);
/* EC driver currently not unloadable */
/* EC driver currently not unloadable */
#if 0
#if 0
static void __exit
acpi_ec_ecdt_exit (void)
{
if (!ec_ecdt)
return;
acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
acpi_remove_gpe_handler(ec_ecdt->gpe_bit, &acpi_ec_gpe_handler);
kfree(ec_ecdt);
}
static void __exit
static void __exit
acpi_ec_exit (void)
acpi_ec_exit (void)
{
{
...
@@ -818,8 +855,6 @@ acpi_ec_exit (void)
...
@@ -818,8 +855,6 @@ acpi_ec_exit (void)
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
acpi_ec_ecdt_exit();
return_VOID;
return_VOID;
}
}
#endif /* 0 */
#endif /* 0 */
...
...
include/linux/acpi.h
View file @
772c0cf1
...
@@ -419,6 +419,12 @@ int acpi_pci_irq_init (void);
...
@@ -419,6 +419,12 @@ int acpi_pci_irq_init (void);
#endif
/*CONFIG_ACPI_PCI*/
#endif
/*CONFIG_ACPI_PCI*/
#ifdef CONFIG_ACPI_EC
int
ec_read
(
u8
addr
,
u8
*
val
);
int
ec_write
(
u8
addr
,
u8
val
);
#endif
/*CONFIG_ACPI_EC*/
#ifdef CONFIG_ACPI
#ifdef CONFIG_ACPI
...
...
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