Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
9db16e4c
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9db16e4c
编写于
11月 09, 2011
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ASoC: Convert WM5100 gpiolib support to direct regmap API usage
Signed-off-by:
N
Mark Brown
<
broonie@opensource.wolfsonmicro.com
>
上级
abda5dfd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
27 deletion
+25
-27
sound/soc/codecs/wm5100.c
sound/soc/codecs/wm5100.c
+25
-27
未找到文件。
sound/soc/codecs/wm5100.c
浏览文件 @
9db16e4c
...
...
@@ -2352,24 +2352,22 @@ static inline struct wm5100_priv *gpio_to_wm5100(struct gpio_chip *chip)
static
void
wm5100_gpio_set
(
struct
gpio_chip
*
chip
,
unsigned
offset
,
int
value
)
{
struct
wm5100_priv
*
wm5100
=
gpio_to_wm5100
(
chip
);
struct
snd_soc_codec
*
codec
=
wm5100
->
codec
;
snd_soc_update_bits
(
codec
,
WM5100_GPIO_CTRL_1
+
offset
,
WM5100_GP1_LVL
,
!!
value
<<
WM5100_GP1_LVL_SHIFT
);
regmap_update_bits
(
wm5100
->
regmap
,
WM5100_GPIO_CTRL_1
+
offset
,
WM5100_GP1_LVL
,
!!
value
<<
WM5100_GP1_LVL_SHIFT
);
}
static
int
wm5100_gpio_direction_out
(
struct
gpio_chip
*
chip
,
unsigned
offset
,
int
value
)
{
struct
wm5100_priv
*
wm5100
=
gpio_to_wm5100
(
chip
);
struct
snd_soc_codec
*
codec
=
wm5100
->
codec
;
int
val
,
ret
;
val
=
(
1
<<
WM5100_GP1_FN_SHIFT
)
|
(
!!
value
<<
WM5100_GP1_LVL_SHIFT
);
ret
=
snd_soc_update_bits
(
codec
,
WM5100_GPIO_CTRL_1
+
offset
,
WM5100_GP1_FN_MASK
|
WM5100_GP1_DIR
|
WM5100_GP1_LVL
,
val
);
ret
=
regmap_update_bits
(
wm5100
->
regmap
,
WM5100_GPIO_CTRL_1
+
offset
,
WM5100_GP1_FN_MASK
|
WM5100_GP1_DIR
|
WM5100_GP1_LVL
,
val
);
if
(
ret
<
0
)
return
ret
;
else
...
...
@@ -2379,25 +2377,24 @@ static int wm5100_gpio_direction_out(struct gpio_chip *chip,
static
int
wm5100_gpio_get
(
struct
gpio_chip
*
chip
,
unsigned
offset
)
{
struct
wm5100_priv
*
wm5100
=
gpio_to_wm5100
(
chip
);
struct
snd_soc_codec
*
codec
=
wm5100
->
codec
;
unsigned
int
reg
;
int
ret
;
ret
=
snd_soc_read
(
codec
,
WM5100_GPIO_CTRL_1
+
offset
);
ret
=
regmap_read
(
wm5100
->
regmap
,
WM5100_GPIO_CTRL_1
+
offset
,
&
reg
);
if
(
ret
<
0
)
return
ret
;
return
(
re
t
&
WM5100_GP1_LVL
)
!=
0
;
return
(
re
g
&
WM5100_GP1_LVL
)
!=
0
;
}
static
int
wm5100_gpio_direction_in
(
struct
gpio_chip
*
chip
,
unsigned
offset
)
{
struct
wm5100_priv
*
wm5100
=
gpio_to_wm5100
(
chip
);
struct
snd_soc_codec
*
codec
=
wm5100
->
codec
;
return
snd_soc_update_bits
(
codec
,
WM5100_GPIO_CTRL_1
+
offset
,
WM5100_GP1_FN_MASK
|
WM5100_GP1_DIR
,
(
1
<<
WM5100_GP1_FN_SHIFT
)
|
(
1
<<
WM5100_GP1_DIR_SHIFT
));
return
regmap_update_bits
(
wm5100
->
regmap
,
WM5100_GPIO_CTRL_1
+
offset
,
WM5100_GP1_FN_MASK
|
WM5100_GP1_DIR
,
(
1
<<
WM5100_GP1_FN_SHIFT
)
|
(
1
<<
WM5100_GP1_DIR_SHIFT
));
}
static
struct
gpio_chip
wm5100_template_chip
=
{
...
...
@@ -2410,14 +2407,14 @@ static struct gpio_chip wm5100_template_chip = {
.
can_sleep
=
1
,
};
static
void
wm5100_init_gpio
(
struct
snd_soc_codec
*
code
c
)
static
void
wm5100_init_gpio
(
struct
i2c_client
*
i2
c
)
{
struct
wm5100_priv
*
wm5100
=
snd_soc_codec_get_drvdata
(
code
c
);
struct
wm5100_priv
*
wm5100
=
i2c_get_clientdata
(
i2
c
);
int
ret
;
wm5100
->
gpio_chip
=
wm5100_template_chip
;
wm5100
->
gpio_chip
.
ngpio
=
6
;
wm5100
->
gpio_chip
.
dev
=
code
c
->
dev
;
wm5100
->
gpio_chip
.
dev
=
&
i2
c
->
dev
;
if
(
wm5100
->
pdata
.
gpio_base
)
wm5100
->
gpio_chip
.
base
=
wm5100
->
pdata
.
gpio_base
;
...
...
@@ -2426,24 +2423,24 @@ static void wm5100_init_gpio(struct snd_soc_codec *codec)
ret
=
gpiochip_add
(
&
wm5100
->
gpio_chip
);
if
(
ret
!=
0
)
dev_err
(
code
c
->
dev
,
"Failed to add GPIOs: %d
\n
"
,
ret
);
dev_err
(
&
i2
c
->
dev
,
"Failed to add GPIOs: %d
\n
"
,
ret
);
}
static
void
wm5100_free_gpio
(
struct
snd_soc_codec
*
code
c
)
static
void
wm5100_free_gpio
(
struct
i2c_client
*
i2
c
)
{
struct
wm5100_priv
*
wm5100
=
snd_soc_codec_get_drvdata
(
code
c
);
struct
wm5100_priv
*
wm5100
=
i2c_get_clientdata
(
i2
c
);
int
ret
;
ret
=
gpiochip_remove
(
&
wm5100
->
gpio_chip
);
if
(
ret
!=
0
)
dev_err
(
code
c
->
dev
,
"Failed to remove GPIOs: %d
\n
"
,
ret
);
dev_err
(
&
i2
c
->
dev
,
"Failed to remove GPIOs: %d
\n
"
,
ret
);
}
#else
static
void
wm5100_init_gpio
(
struct
snd_soc_codec
*
code
c
)
static
void
wm5100_init_gpio
(
struct
i2c_client
*
i2
c
)
{
}
static
void
wm5100_free_gpio
(
struct
snd_soc_codec
*
code
c
)
static
void
wm5100_free_gpio
(
struct
i2c_client
*
i2
c
)
{
}
#endif
...
...
@@ -2465,7 +2462,6 @@ static int wm5100_probe(struct snd_soc_codec *codec)
regcache_cache_only
(
wm5100
->
regmap
,
true
);
wm5100_init_gpio
(
codec
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
wm5100_dig_vu
);
i
++
)
snd_soc_update_bits
(
codec
,
wm5100_dig_vu
[
i
],
WM5100_OUT_VU
,
...
...
@@ -2573,7 +2569,6 @@ static int wm5100_probe(struct snd_soc_codec *codec)
err_gpio:
if
(
i2c
->
irq
)
free_irq
(
i2c
->
irq
,
codec
);
wm5100_free_gpio
(
codec
);
return
ret
;
}
...
...
@@ -2589,7 +2584,6 @@ static int wm5100_remove(struct snd_soc_codec *codec)
}
if
(
i2c
->
irq
)
free_irq
(
i2c
->
irq
,
codec
);
wm5100_free_gpio
(
codec
);
return
0
;
}
...
...
@@ -2743,6 +2737,8 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
goto
err_reset
;
}
wm5100_init_gpio
(
i2c
);
ret
=
snd_soc_register_codec
(
&
i2c
->
dev
,
&
soc_codec_dev_wm5100
,
wm5100_dai
,
ARRAY_SIZE
(
wm5100_dai
));
...
...
@@ -2754,6 +2750,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
return
ret
;
err_reset:
wm5100_free_gpio
(
i2c
);
if
(
wm5100
->
pdata
.
reset
)
{
gpio_set_value_cansleep
(
wm5100
->
pdata
.
reset
,
1
);
gpio_free
(
wm5100
->
pdata
.
reset
);
...
...
@@ -2787,6 +2784,7 @@ static __devexit int wm5100_i2c_remove(struct i2c_client *client)
struct
wm5100_priv
*
wm5100
=
i2c_get_clientdata
(
client
);
snd_soc_unregister_codec
(
&
client
->
dev
);
wm5100_free_gpio
(
client
);
if
(
wm5100
->
pdata
.
reset
)
{
gpio_set_value_cansleep
(
wm5100
->
pdata
.
reset
,
1
);
gpio_free
(
wm5100
->
pdata
.
reset
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录