Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
35541874
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
35541874
编写于
11月 30, 2017
作者:
L
Linus Walleij
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'ib-gpio-acpi-quirks' into devel
上级
81930328
1b2ca32a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
24 deletion
+50
-24
drivers/gpio/gpiolib-acpi.c
drivers/gpio/gpiolib-acpi.c
+38
-19
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.c
+1
-3
drivers/gpio/gpiolib.h
drivers/gpio/gpiolib.h
+6
-2
include/linux/acpi.h
include/linux/acpi.h
+5
-0
未找到文件。
drivers/gpio/gpiolib-acpi.c
浏览文件 @
35541874
...
@@ -414,7 +414,8 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios);
...
@@ -414,7 +414,8 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios);
static
bool
acpi_get_driver_gpio_data
(
struct
acpi_device
*
adev
,
static
bool
acpi_get_driver_gpio_data
(
struct
acpi_device
*
adev
,
const
char
*
name
,
int
index
,
const
char
*
name
,
int
index
,
struct
acpi_reference_args
*
args
)
struct
acpi_reference_args
*
args
,
unsigned
int
*
quirks
)
{
{
const
struct
acpi_gpio_mapping
*
gm
;
const
struct
acpi_gpio_mapping
*
gm
;
...
@@ -430,6 +431,8 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
...
@@ -430,6 +431,8 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
args
->
args
[
1
]
=
par
->
line_index
;
args
->
args
[
1
]
=
par
->
line_index
;
args
->
args
[
2
]
=
par
->
active_low
;
args
->
args
[
2
]
=
par
->
active_low
;
args
->
nargs
=
3
;
args
->
nargs
=
3
;
*
quirks
=
gm
->
quirks
;
return
true
;
return
true
;
}
}
...
@@ -461,8 +464,8 @@ acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio)
...
@@ -461,8 +464,8 @@ acpi_gpio_to_gpiod_flags(const struct acpi_resource_gpio *agpio)
}
}
}
}
int
static
int
acpi_gpio_update_gpiod_flags
(
enum
gpiod_flags
*
flags
,
enum
gpiod_flags
update
)
__
acpi_gpio_update_gpiod_flags
(
enum
gpiod_flags
*
flags
,
enum
gpiod_flags
update
)
{
{
int
ret
=
0
;
int
ret
=
0
;
...
@@ -489,12 +492,31 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
...
@@ -489,12 +492,31 @@ acpi_gpio_update_gpiod_flags(enum gpiod_flags *flags, enum gpiod_flags update)
return
ret
;
return
ret
;
}
}
int
acpi_gpio_update_gpiod_flags
(
enum
gpiod_flags
*
flags
,
struct
acpi_gpio_info
*
info
)
{
struct
device
*
dev
=
&
info
->
adev
->
dev
;
enum
gpiod_flags
old
=
*
flags
;
int
ret
;
ret
=
__acpi_gpio_update_gpiod_flags
(
&
old
,
info
->
flags
);
if
(
info
->
quirks
&
ACPI_GPIO_QUIRK_NO_IO_RESTRICTION
)
{
if
(
ret
)
dev_warn
(
dev
,
FW_BUG
"GPIO not in correct mode, fixing
\n
"
);
}
else
{
if
(
ret
)
dev_dbg
(
dev
,
"Override GPIO initialization flags
\n
"
);
*
flags
=
old
;
}
return
ret
;
}
struct
acpi_gpio_lookup
{
struct
acpi_gpio_lookup
{
struct
acpi_gpio_info
info
;
struct
acpi_gpio_info
info
;
int
index
;
int
index
;
int
pin_index
;
int
pin_index
;
bool
active_low
;
bool
active_low
;
struct
acpi_device
*
adev
;
struct
gpio_desc
*
desc
;
struct
gpio_desc
*
desc
;
int
n
;
int
n
;
};
};
...
@@ -531,8 +553,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
...
@@ -531,8 +553,8 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
lookup
->
info
.
triggering
=
agpio
->
triggering
;
lookup
->
info
.
triggering
=
agpio
->
triggering
;
}
else
{
}
else
{
lookup
->
info
.
flags
=
acpi_gpio_to_gpiod_flags
(
agpio
);
lookup
->
info
.
flags
=
acpi_gpio_to_gpiod_flags
(
agpio
);
lookup
->
info
.
polarity
=
lookup
->
active_low
;
}
}
}
}
return
1
;
return
1
;
...
@@ -541,12 +563,13 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
...
@@ -541,12 +563,13 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)
static
int
acpi_gpio_resource_lookup
(
struct
acpi_gpio_lookup
*
lookup
,
static
int
acpi_gpio_resource_lookup
(
struct
acpi_gpio_lookup
*
lookup
,
struct
acpi_gpio_info
*
info
)
struct
acpi_gpio_info
*
info
)
{
{
struct
acpi_device
*
adev
=
lookup
->
info
.
adev
;
struct
list_head
res_list
;
struct
list_head
res_list
;
int
ret
;
int
ret
;
INIT_LIST_HEAD
(
&
res_list
);
INIT_LIST_HEAD
(
&
res_list
);
ret
=
acpi_dev_get_resources
(
lookup
->
adev
,
&
res_list
,
ret
=
acpi_dev_get_resources
(
adev
,
&
res_list
,
acpi_populate_gpio_lookup
,
acpi_populate_gpio_lookup
,
lookup
);
lookup
);
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -557,11 +580,8 @@ static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup,
...
@@ -557,11 +580,8 @@ static int acpi_gpio_resource_lookup(struct acpi_gpio_lookup *lookup,
if
(
!
lookup
->
desc
)
if
(
!
lookup
->
desc
)
return
-
ENOENT
;
return
-
ENOENT
;
if
(
info
)
{
if
(
info
)
*
info
=
lookup
->
info
;
*
info
=
lookup
->
info
;
if
(
lookup
->
active_low
)
info
->
polarity
=
lookup
->
active_low
;
}
return
0
;
return
0
;
}
}
...
@@ -570,6 +590,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
...
@@ -570,6 +590,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
struct
acpi_gpio_lookup
*
lookup
)
struct
acpi_gpio_lookup
*
lookup
)
{
{
struct
acpi_reference_args
args
;
struct
acpi_reference_args
args
;
unsigned
int
quirks
=
0
;
int
ret
;
int
ret
;
memset
(
&
args
,
0
,
sizeof
(
args
));
memset
(
&
args
,
0
,
sizeof
(
args
));
...
@@ -581,14 +602,14 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
...
@@ -581,14 +602,14 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
if
(
!
adev
)
if
(
!
adev
)
return
ret
;
return
ret
;
if
(
!
acpi_get_driver_gpio_data
(
adev
,
propname
,
index
,
&
args
))
if
(
!
acpi_get_driver_gpio_data
(
adev
,
propname
,
index
,
&
args
,
&
quirks
))
return
ret
;
return
ret
;
}
}
/*
/*
* The property was found and resolved, so need to lookup the GPIO based
* The property was found and resolved, so need to lookup the GPIO based
* on returned args.
* on returned args.
*/
*/
lookup
->
adev
=
args
.
adev
;
if
(
args
.
nargs
!=
3
)
if
(
args
.
nargs
!=
3
)
return
-
EPROTO
;
return
-
EPROTO
;
...
@@ -596,6 +617,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
...
@@ -596,6 +617,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode,
lookup
->
pin_index
=
args
.
args
[
1
];
lookup
->
pin_index
=
args
.
args
[
1
];
lookup
->
active_low
=
!!
args
.
args
[
2
];
lookup
->
active_low
=
!!
args
.
args
[
2
];
lookup
->
info
.
adev
=
args
.
adev
;
lookup
->
info
.
quirks
=
quirks
;
return
0
;
return
0
;
}
}
...
@@ -643,11 +666,11 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev,
...
@@ -643,11 +666,11 @@ static struct gpio_desc *acpi_get_gpiod_by_index(struct acpi_device *adev,
return
ERR_PTR
(
ret
);
return
ERR_PTR
(
ret
);
dev_dbg
(
&
adev
->
dev
,
"GPIO: _DSD returned %s %d %d %u
\n
"
,
dev_dbg
(
&
adev
->
dev
,
"GPIO: _DSD returned %s %d %d %u
\n
"
,
dev_name
(
&
lookup
.
adev
->
dev
),
lookup
.
index
,
dev_name
(
&
lookup
.
info
.
adev
->
dev
),
lookup
.
index
,
lookup
.
pin_index
,
lookup
.
active_low
);
lookup
.
pin_index
,
lookup
.
active_low
);
}
else
{
}
else
{
dev_dbg
(
&
adev
->
dev
,
"GPIO: looking up %d in _CRS
\n
"
,
index
);
dev_dbg
(
&
adev
->
dev
,
"GPIO: looking up %d in _CRS
\n
"
,
index
);
lookup
.
adev
=
adev
;
lookup
.
info
.
adev
=
adev
;
}
}
ret
=
acpi_gpio_resource_lookup
(
&
lookup
,
info
);
ret
=
acpi_gpio_resource_lookup
(
&
lookup
,
info
);
...
@@ -664,7 +687,6 @@ struct gpio_desc *acpi_find_gpio(struct device *dev,
...
@@ -664,7 +687,6 @@ struct gpio_desc *acpi_find_gpio(struct device *dev,
struct
acpi_gpio_info
info
;
struct
acpi_gpio_info
info
;
struct
gpio_desc
*
desc
;
struct
gpio_desc
*
desc
;
char
propname
[
32
];
char
propname
[
32
];
int
err
;
int
i
;
int
i
;
/* Try first from _DSD */
/* Try first from _DSD */
...
@@ -703,10 +725,7 @@ struct gpio_desc *acpi_find_gpio(struct device *dev,
...
@@ -703,10 +725,7 @@ struct gpio_desc *acpi_find_gpio(struct device *dev,
if
(
info
.
polarity
==
GPIO_ACTIVE_LOW
)
if
(
info
.
polarity
==
GPIO_ACTIVE_LOW
)
*
lookupflags
|=
GPIO_ACTIVE_LOW
;
*
lookupflags
|=
GPIO_ACTIVE_LOW
;
err
=
acpi_gpio_update_gpiod_flags
(
dflags
,
info
.
flags
);
acpi_gpio_update_gpiod_flags
(
dflags
,
&
info
);
if
(
err
)
dev_dbg
(
dev
,
"Override GPIO initialization flags
\n
"
);
return
desc
;
return
desc
;
}
}
...
...
drivers/gpio/gpiolib.c
浏览文件 @
35541874
...
@@ -3690,9 +3690,7 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
...
@@ -3690,9 +3690,7 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
desc
=
acpi_node_get_gpiod
(
fwnode
,
propname
,
index
,
&
info
);
desc
=
acpi_node_get_gpiod
(
fwnode
,
propname
,
index
,
&
info
);
if
(
!
IS_ERR
(
desc
))
{
if
(
!
IS_ERR
(
desc
))
{
active_low
=
info
.
polarity
==
GPIO_ACTIVE_LOW
;
active_low
=
info
.
polarity
==
GPIO_ACTIVE_LOW
;
ret
=
acpi_gpio_update_gpiod_flags
(
&
dflags
,
info
.
flags
);
acpi_gpio_update_gpiod_flags
(
&
dflags
,
&
info
);
if
(
ret
)
pr_debug
(
"Override GPIO initialization flags
\n
"
);
}
}
}
}
...
...
drivers/gpio/gpiolib.h
浏览文件 @
35541874
...
@@ -75,16 +75,20 @@ struct gpio_device {
...
@@ -75,16 +75,20 @@ struct gpio_device {
/**
/**
* struct acpi_gpio_info - ACPI GPIO specific information
* struct acpi_gpio_info - ACPI GPIO specific information
* @adev: reference to ACPI device which consumes GPIO resource
* @flags: GPIO initialization flags
* @flags: GPIO initialization flags
* @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
* @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
* @polarity: interrupt polarity as provided by ACPI
* @polarity: interrupt polarity as provided by ACPI
* @triggering: triggering type as provided by ACPI
* @triggering: triggering type as provided by ACPI
* @quirks: Linux specific quirks as provided by struct acpi_gpio_mapping
*/
*/
struct
acpi_gpio_info
{
struct
acpi_gpio_info
{
struct
acpi_device
*
adev
;
enum
gpiod_flags
flags
;
enum
gpiod_flags
flags
;
bool
gpioint
;
bool
gpioint
;
int
polarity
;
int
polarity
;
int
triggering
;
int
triggering
;
unsigned
int
quirks
;
};
};
/* gpio suffixes used for ACPI and device tree lookup */
/* gpio suffixes used for ACPI and device tree lookup */
...
@@ -124,7 +128,7 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
...
@@ -124,7 +128,7 @@ void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
void
acpi_gpiochip_free_interrupts
(
struct
gpio_chip
*
chip
);
void
acpi_gpiochip_free_interrupts
(
struct
gpio_chip
*
chip
);
int
acpi_gpio_update_gpiod_flags
(
enum
gpiod_flags
*
flags
,
int
acpi_gpio_update_gpiod_flags
(
enum
gpiod_flags
*
flags
,
enum
gpiod_flags
update
);
struct
acpi_gpio_info
*
info
);
struct
gpio_desc
*
acpi_find_gpio
(
struct
device
*
dev
,
struct
gpio_desc
*
acpi_find_gpio
(
struct
device
*
dev
,
const
char
*
con_id
,
const
char
*
con_id
,
...
@@ -149,7 +153,7 @@ static inline void
...
@@ -149,7 +153,7 @@ static inline void
acpi_gpiochip_free_interrupts
(
struct
gpio_chip
*
chip
)
{
}
acpi_gpiochip_free_interrupts
(
struct
gpio_chip
*
chip
)
{
}
static
inline
int
static
inline
int
acpi_gpio_update_gpiod_flags
(
enum
gpiod_flags
*
flags
,
enum
gpiod_flags
update
)
acpi_gpio_update_gpiod_flags
(
enum
gpiod_flags
*
flags
,
struct
acpi_gpio_info
*
info
)
{
{
return
0
;
return
0
;
}
}
...
...
include/linux/acpi.h
浏览文件 @
35541874
...
@@ -978,6 +978,11 @@ struct acpi_gpio_mapping {
...
@@ -978,6 +978,11 @@ struct acpi_gpio_mapping {
const
char
*
name
;
const
char
*
name
;
const
struct
acpi_gpio_params
*
data
;
const
struct
acpi_gpio_params
*
data
;
unsigned
int
size
;
unsigned
int
size
;
/* Ignore IoRestriction field */
#define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0)
unsigned
int
quirks
;
};
};
#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
#if defined(CONFIG_ACPI) && defined(CONFIG_GPIOLIB)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录