Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
9e3699fc
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e3699fc
编写于
5月 21, 2018
作者:
G
Guenter Roeck
浏览文件
操作
浏览文件
下载
差异文件
Merge tag 'ib-mfd-hwmon-v4.18' into hwmon-next
Immutable branch between MFD and HWMON due for the v4.18 merge window
上级
5d9ca430
ed645ccc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
76 addition
and
1 deletion
+76
-1
drivers/hwmon/mc13783-adc.c
drivers/hwmon/mc13783-adc.c
+60
-0
drivers/mfd/mc13xxx-core.c
drivers/mfd/mc13xxx-core.c
+14
-1
include/linux/mfd/mc13xxx.h
include/linux/mfd/mc13xxx.h
+2
-0
未找到文件。
drivers/hwmon/mc13783-adc.c
浏览文件 @
9e3699fc
...
@@ -63,6 +63,10 @@ static int mc13783_adc_read(struct device *dev,
...
@@ -63,6 +63,10 @@ static int mc13783_adc_read(struct device *dev,
if
(
ret
)
if
(
ret
)
return
ret
;
return
ret
;
/* ADIN7 subchannels */
if
(
channel
>=
16
)
channel
=
7
;
channel
&=
0x7
;
channel
&=
0x7
;
*
val
=
(
sample
[
channel
%
4
]
>>
(
channel
>
3
?
14
:
2
))
&
0x3ff
;
*
val
=
(
sample
[
channel
%
4
]
>>
(
channel
>
3
?
14
:
2
))
&
0x3ff
;
...
@@ -111,6 +115,57 @@ static ssize_t mc13783_adc_read_gp(struct device *dev,
...
@@ -111,6 +115,57 @@ static ssize_t mc13783_adc_read_gp(struct device *dev,
return
sprintf
(
buf
,
"%u
\n
"
,
val
);
return
sprintf
(
buf
,
"%u
\n
"
,
val
);
}
}
static
ssize_t
mc13783_adc_read_uid
(
struct
device
*
dev
,
struct
device_attribute
*
devattr
,
char
*
buf
)
{
unsigned
int
val
;
struct
platform_device
*
pdev
=
to_platform_device
(
dev
);
kernel_ulong_t
driver_data
=
platform_get_device_id
(
pdev
)
->
driver_data
;
int
ret
=
mc13783_adc_read
(
dev
,
devattr
,
&
val
);
if
(
ret
)
return
ret
;
if
(
driver_data
&
MC13783_ADC_BPDIV2
)
/* MC13892 have 1/2 divider, input range is [0, 4.800V] */
val
=
DIV_ROUND_CLOSEST
(
val
*
4800
,
1024
);
else
/* MC13783 have 0.9 divider, input range is [0, 2.555V] */
val
=
DIV_ROUND_CLOSEST
(
val
*
2555
,
1024
);
return
sprintf
(
buf
,
"%u
\n
"
,
val
);
}
static
ssize_t
mc13783_adc_read_temp
(
struct
device
*
dev
,
struct
device_attribute
*
devattr
,
char
*
buf
)
{
unsigned
int
val
;
struct
platform_device
*
pdev
=
to_platform_device
(
dev
);
kernel_ulong_t
driver_data
=
platform_get_device_id
(
pdev
)
->
driver_data
;
int
ret
=
mc13783_adc_read
(
dev
,
devattr
,
&
val
);
if
(
ret
)
return
ret
;
if
(
driver_data
&
MC13783_ADC_BPDIV2
)
{
/*
* MC13892:
* Die Temperature Read Out Code at 25C 680
* Temperature change per LSB +0.4244C
*/
ret
=
DIV_ROUND_CLOSEST
(
-
2635920
+
val
*
4244
,
10
);
}
else
{
/*
* MC13783:
* Die Temperature Read Out Code at 25C 282
* Temperature change per LSB -1.14C
*/
ret
=
346480
-
1140
*
val
;
}
return
sprintf
(
buf
,
"%d
\n
"
,
ret
);
}
static
DEVICE_ATTR_RO
(
name
);
static
DEVICE_ATTR_RO
(
name
);
static
SENSOR_DEVICE_ATTR
(
in2_input
,
S_IRUGO
,
mc13783_adc_read_bp
,
NULL
,
2
);
static
SENSOR_DEVICE_ATTR
(
in2_input
,
S_IRUGO
,
mc13783_adc_read_bp
,
NULL
,
2
);
static
SENSOR_DEVICE_ATTR
(
in5_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
5
);
static
SENSOR_DEVICE_ATTR
(
in5_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
5
);
...
@@ -124,6 +179,9 @@ static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, mc13783_adc_read_gp, NULL, 12);
...
@@ -124,6 +179,9 @@ static SENSOR_DEVICE_ATTR(in12_input, S_IRUGO, mc13783_adc_read_gp, NULL, 12);
static
SENSOR_DEVICE_ATTR
(
in13_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
13
);
static
SENSOR_DEVICE_ATTR
(
in13_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
13
);
static
SENSOR_DEVICE_ATTR
(
in14_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
14
);
static
SENSOR_DEVICE_ATTR
(
in14_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
14
);
static
SENSOR_DEVICE_ATTR
(
in15_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
15
);
static
SENSOR_DEVICE_ATTR
(
in15_input
,
S_IRUGO
,
mc13783_adc_read_gp
,
NULL
,
15
);
static
SENSOR_DEVICE_ATTR
(
in16_input
,
S_IRUGO
,
mc13783_adc_read_uid
,
NULL
,
16
);
static
SENSOR_DEVICE_ATTR
(
temp1_input
,
S_IRUGO
,
mc13783_adc_read_temp
,
NULL
,
17
);
static
struct
attribute
*
mc13783_attr_base
[]
=
{
static
struct
attribute
*
mc13783_attr_base
[]
=
{
&
dev_attr_name
.
attr
,
&
dev_attr_name
.
attr
,
...
@@ -131,6 +189,8 @@ static struct attribute *mc13783_attr_base[] = {
...
@@ -131,6 +189,8 @@ static struct attribute *mc13783_attr_base[] = {
&
sensor_dev_attr_in5_input
.
dev_attr
.
attr
,
&
sensor_dev_attr_in5_input
.
dev_attr
.
attr
,
&
sensor_dev_attr_in6_input
.
dev_attr
.
attr
,
&
sensor_dev_attr_in6_input
.
dev_attr
.
attr
,
&
sensor_dev_attr_in7_input
.
dev_attr
.
attr
,
&
sensor_dev_attr_in7_input
.
dev_attr
.
attr
,
&
sensor_dev_attr_in16_input
.
dev_attr
.
attr
,
&
sensor_dev_attr_temp1_input
.
dev_attr
.
attr
,
NULL
NULL
};
};
...
...
drivers/mfd/mc13xxx-core.c
浏览文件 @
9e3699fc
...
@@ -279,8 +279,21 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,
...
@@ -279,8 +279,21 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,
adc0
=
MC13XXX_ADC0_ADINC1
|
MC13XXX_ADC0_ADINC2
;
adc0
=
MC13XXX_ADC0_ADINC1
|
MC13XXX_ADC0_ADINC2
;
adc1
=
MC13XXX_ADC1_ADEN
|
MC13XXX_ADC1_ADTRIGIGN
|
MC13XXX_ADC1_ASC
;
adc1
=
MC13XXX_ADC1_ADEN
|
MC13XXX_ADC1_ADTRIGIGN
|
MC13XXX_ADC1_ASC
;
if
(
channel
>
7
)
/*
* Channels mapped through ADIN7:
* 7 - General purpose ADIN7
* 16 - UID
* 17 - Die temperature
*/
if
(
channel
>
7
&&
channel
<
16
)
{
adc1
|=
MC13XXX_ADC1_ADSEL
;
adc1
|=
MC13XXX_ADC1_ADSEL
;
}
else
if
(
channel
==
16
)
{
adc0
|=
MC13XXX_ADC0_ADIN7SEL_UID
;
channel
=
7
;
}
else
if
(
channel
==
17
)
{
adc0
|=
MC13XXX_ADC0_ADIN7SEL_DIE
;
channel
=
7
;
}
switch
(
mode
)
{
switch
(
mode
)
{
case
MC13XXX_ADC_MODE_TS
:
case
MC13XXX_ADC_MODE_TS
:
...
...
include/linux/mfd/mc13xxx.h
浏览文件 @
9e3699fc
...
@@ -243,6 +243,8 @@ struct mc13xxx_platform_data {
...
@@ -243,6 +243,8 @@ struct mc13xxx_platform_data {
#define MC13XXX_ADC0_LICELLCON (1 << 0)
#define MC13XXX_ADC0_LICELLCON (1 << 0)
#define MC13XXX_ADC0_CHRGICON (1 << 1)
#define MC13XXX_ADC0_CHRGICON (1 << 1)
#define MC13XXX_ADC0_BATICON (1 << 2)
#define MC13XXX_ADC0_BATICON (1 << 2)
#define MC13XXX_ADC0_ADIN7SEL_DIE (1 << 4)
#define MC13XXX_ADC0_ADIN7SEL_UID (2 << 4)
#define MC13XXX_ADC0_ADREFEN (1 << 10)
#define MC13XXX_ADC0_ADREFEN (1 << 10)
#define MC13XXX_ADC0_TSMOD0 (1 << 12)
#define MC13XXX_ADC0_TSMOD0 (1 << 12)
#define MC13XXX_ADC0_TSMOD1 (1 << 13)
#define MC13XXX_ADC0_TSMOD1 (1 << 13)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录