Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
bcedaba1
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看板
提交
bcedaba1
编写于
7月 25, 2016
作者:
T
Thierry Reding
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fixes' into for-next
上级
1a695a90
33cdcee0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
9 deletion
+17
-9
drivers/pwm/core.c
drivers/pwm/core.c
+2
-1
drivers/pwm/pwm-atmel-hlcdc.c
drivers/pwm/pwm-atmel-hlcdc.c
+1
-1
drivers/pwm/sysfs.c
drivers/pwm/sysfs.c
+1
-1
include/linux/pwm.h
include/linux/pwm.h
+13
-6
未找到文件。
drivers/pwm/core.c
浏览文件 @
bcedaba1
...
@@ -457,7 +457,8 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state)
...
@@ -457,7 +457,8 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state)
{
{
int
err
;
int
err
;
if
(
!
pwm
)
if
(
!
pwm
||
!
state
||
!
state
->
period
||
state
->
duty_cycle
>
state
->
period
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
!
memcmp
(
state
,
&
pwm
->
state
,
sizeof
(
*
state
)))
if
(
!
memcmp
(
state
,
&
pwm
->
state
,
sizeof
(
*
state
)))
...
...
drivers/pwm/pwm-atmel-hlcdc.c
浏览文件 @
bcedaba1
...
@@ -272,7 +272,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
...
@@ -272,7 +272,7 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
chip
->
chip
.
of_pwm_n_cells
=
3
;
chip
->
chip
.
of_pwm_n_cells
=
3
;
chip
->
chip
.
can_sleep
=
1
;
chip
->
chip
.
can_sleep
=
1
;
ret
=
pwmchip_add
(
&
chip
->
chip
);
ret
=
pwmchip_add
_with_polarity
(
&
chip
->
chip
,
PWM_POLARITY_INVERSED
);
if
(
ret
)
{
if
(
ret
)
{
clk_disable_unprepare
(
hlcdc
->
periph_clk
);
clk_disable_unprepare
(
hlcdc
->
periph_clk
);
return
ret
;
return
ret
;
...
...
drivers/pwm/sysfs.c
浏览文件 @
bcedaba1
...
@@ -152,7 +152,7 @@ static ssize_t enable_store(struct device *child,
...
@@ -152,7 +152,7 @@ static ssize_t enable_store(struct device *child,
goto
unlock
;
goto
unlock
;
}
}
pwm_apply_state
(
pwm
,
&
state
);
ret
=
pwm_apply_state
(
pwm
,
&
state
);
unlock:
unlock:
mutex_unlock
(
&
export
->
lock
);
mutex_unlock
(
&
export
->
lock
);
...
...
include/linux/pwm.h
浏览文件 @
bcedaba1
...
@@ -235,6 +235,9 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns,
...
@@ -235,6 +235,9 @@ static inline int pwm_config(struct pwm_device *pwm, int duty_ns,
if
(
!
pwm
)
if
(
!
pwm
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
duty_ns
<
0
||
period_ns
<
0
)
return
-
EINVAL
;
pwm_get_state
(
pwm
,
&
state
);
pwm_get_state
(
pwm
,
&
state
);
if
(
state
.
duty_cycle
==
duty_ns
&&
state
.
period
==
period_ns
)
if
(
state
.
duty_cycle
==
duty_ns
&&
state
.
period
==
period_ns
)
return
0
;
return
0
;
...
@@ -461,6 +464,8 @@ static inline bool pwm_can_sleep(struct pwm_device *pwm)
...
@@ -461,6 +464,8 @@ static inline bool pwm_can_sleep(struct pwm_device *pwm)
static
inline
void
pwm_apply_args
(
struct
pwm_device
*
pwm
)
static
inline
void
pwm_apply_args
(
struct
pwm_device
*
pwm
)
{
{
struct
pwm_state
state
=
{
};
/*
/*
* PWM users calling pwm_apply_args() expect to have a fresh config
* PWM users calling pwm_apply_args() expect to have a fresh config
* where the polarity and period are set according to pwm_args info.
* where the polarity and period are set according to pwm_args info.
...
@@ -473,18 +478,20 @@ static inline void pwm_apply_args(struct pwm_device *pwm)
...
@@ -473,18 +478,20 @@ static inline void pwm_apply_args(struct pwm_device *pwm)
* at startup (even if they are actually enabled), thus authorizing
* at startup (even if they are actually enabled), thus authorizing
* polarity setting.
* polarity setting.
*
*
* Instead of setting ->enabled to false, we call pwm_disable()
* To fulfill this requirement, we apply a new state which disables
* before pwm_set_polarity() to ensure that everything is configured
* the PWM device and set the reference period and polarity config.
* as expected, and the PWM is really disabled when the user request
* it.
*
*
* Note that PWM users requiring a smooth handover between the
* Note that PWM users requiring a smooth handover between the
* bootloader and the kernel (like critical regulators controlled by
* bootloader and the kernel (like critical regulators controlled by
* PWM devices) will have to switch to the atomic API and avoid calling
* PWM devices) will have to switch to the atomic API and avoid calling
* pwm_apply_args().
* pwm_apply_args().
*/
*/
pwm_disable
(
pwm
);
pwm_set_polarity
(
pwm
,
pwm
->
args
.
polarity
);
state
.
enabled
=
false
;
state
.
polarity
=
pwm
->
args
.
polarity
;
state
.
period
=
pwm
->
args
.
period
;
pwm_apply_state
(
pwm
,
&
state
);
}
}
struct
pwm_lookup
{
struct
pwm_lookup
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录