Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
8959f007
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8959f007
编写于
5月 24, 2022
作者:
J
Jiri Kosina
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-5.19/amd-sfh' into for-linus
- support for sensor discovery and code cleanups (Basavaraj Natikar)
上级
fc4ef9d5
806fc359
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
72 addition
and
16 deletion
+72
-16
drivers/hid/amd-sfh-hid/amd_sfh_client.c
drivers/hid/amd-sfh-hid/amd_sfh_client.c
+39
-6
drivers/hid/amd-sfh-hid/amd_sfh_hid.c
drivers/hid/amd-sfh-hid/amd_sfh_hid.c
+7
-2
drivers/hid/amd-sfh-hid/amd_sfh_hid.h
drivers/hid/amd-sfh-hid/amd_sfh_hid.h
+0
-1
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+13
-4
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
+5
-0
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
.../hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
+3
-3
drivers/hid/hid-core.c
drivers/hid/hid-core.c
+4
-0
include/uapi/linux/input.h
include/uapi/linux/input.h
+1
-0
未找到文件。
drivers/hid/amd-sfh-hid/amd_sfh_client.c
浏览文件 @
8959f007
...
...
@@ -141,6 +141,24 @@ u32 amd_sfh_wait_for_response(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_sts)
return
sensor_sts
;
}
const
char
*
get_sensor_name
(
int
idx
)
{
switch
(
idx
)
{
case
accel_idx
:
return
"accelerometer"
;
case
gyro_idx
:
return
"gyroscope"
;
case
mag_idx
:
return
"magnetometer"
;
case
als_idx
:
return
"ALS"
;
case
HPD_IDX
:
return
"HPD"
;
default:
return
"unknown sensor type"
;
}
}
int
amd_sfh_hid_client_init
(
struct
amd_mp2_dev
*
privdata
)
{
struct
amd_input_data
*
in_data
=
&
privdata
->
in_data
;
...
...
@@ -219,13 +237,27 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
(
privdata
,
cl_data
->
sensor_idx
[
i
],
SENSOR_DISABLED
);
if
(
status
!=
SENSOR_ENABLED
)
cl_data
->
sensor_sts
[
i
]
=
SENSOR_DISABLED
;
dev_dbg
(
dev
,
"sid 0x%x status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
cl_data
->
sensor_sts
[
i
]);
dev_dbg
(
dev
,
"sid 0x%x (%s) status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
get_sensor_name
(
cl_data
->
sensor_idx
[
i
]),
cl_data
->
sensor_sts
[
i
]);
goto
cleanup
;
}
}
dev_dbg
(
dev
,
"sid 0x%x status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
cl_data
->
sensor_sts
[
i
]);
dev_dbg
(
dev
,
"sid 0x%x (%s) status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
get_sensor_name
(
cl_data
->
sensor_idx
[
i
]),
cl_data
->
sensor_sts
[
i
]);
}
if
(
privdata
->
mp2_ops
->
discovery_status
&&
privdata
->
mp2_ops
->
discovery_status
(
privdata
)
==
0
)
{
amd_sfh_hid_client_deinit
(
privdata
);
for
(
i
=
0
;
i
<
cl_data
->
num_hid_devices
;
i
++
)
{
devm_kfree
(
dev
,
cl_data
->
feature_report
[
i
]);
devm_kfree
(
dev
,
in_data
->
input_report
[
i
]);
devm_kfree
(
dev
,
cl_data
->
report_descr
[
i
]);
}
dev_warn
(
dev
,
"Failed to discover, sensors not enabled
\n
"
);
return
-
EOPNOTSUPP
;
}
schedule_delayed_work
(
&
cl_data
->
work_buffer
,
msecs_to_jiffies
(
AMD_SFH_IDLE_LOOP
));
return
0
;
...
...
@@ -257,8 +289,9 @@ int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata)
(
privdata
,
cl_data
->
sensor_idx
[
i
],
SENSOR_DISABLED
);
if
(
status
!=
SENSOR_ENABLED
)
cl_data
->
sensor_sts
[
i
]
=
SENSOR_DISABLED
;
dev_dbg
(
&
privdata
->
pdev
->
dev
,
"stopping sid 0x%x status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
cl_data
->
sensor_sts
[
i
]);
dev_dbg
(
&
privdata
->
pdev
->
dev
,
"stopping sid 0x%x (%s) status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
get_sensor_name
(
cl_data
->
sensor_idx
[
i
]),
cl_data
->
sensor_sts
[
i
]);
}
}
...
...
drivers/hid/amd-sfh-hid/amd_sfh_hid.c
浏览文件 @
8959f007
...
...
@@ -12,6 +12,7 @@
#include <linux/sched.h>
#include "amd_sfh_hid.h"
#include "amd_sfh_pcie.h"
#define AMD_SFH_RESPONSE_TIMEOUT 1500
...
...
@@ -120,6 +121,8 @@ static struct hid_ll_driver amdtp_hid_ll_driver = {
int
amdtp_hid_probe
(
u32
cur_hid_dev
,
struct
amdtp_cl_data
*
cli_data
)
{
struct
amd_mp2_dev
*
mp2
=
container_of
(
cli_data
->
in_data
,
struct
amd_mp2_dev
,
in_data
);
struct
device
*
dev
=
&
mp2
->
pdev
->
dev
;
struct
hid_device
*
hid
;
struct
amdtp_hid_data
*
hid_data
;
int
rc
;
...
...
@@ -141,10 +144,12 @@ int amdtp_hid_probe(u32 cur_hid_dev, struct amdtp_cl_data *cli_data)
hid
->
driver_data
=
hid_data
;
cli_data
->
hid_sensor_hubs
[
cur_hid_dev
]
=
hid
;
hid
->
bus
=
BUS_AMD_AMDTP
;
strscpy
(
hid
->
phys
,
dev
->
driver
?
dev
->
driver
->
name
:
dev_name
(
dev
),
sizeof
(
hid
->
phys
));
hid
->
bus
=
BUS_AMD_SFH
;
hid
->
vendor
=
AMD_SFH_HID_VENDOR
;
hid
->
product
=
AMD_SFH_HID_PRODUCT
;
snprintf
(
hid
->
name
,
sizeof
(
hid
->
name
),
"%s %04X:%04X"
,
"hid-amd
tp
"
,
snprintf
(
hid
->
name
,
sizeof
(
hid
->
name
),
"%s %04X:%04X"
,
"hid-amd
sfh
"
,
hid
->
vendor
,
hid
->
product
);
rc
=
hid_add_device
(
hid
);
...
...
drivers/hid/amd-sfh-hid/amd_sfh_hid.h
浏览文件 @
8959f007
...
...
@@ -12,7 +12,6 @@
#define AMDSFH_HID_H
#define MAX_HID_DEVICES 5
#define BUS_AMD_AMDTP 0x20
#define AMD_SFH_HID_VENDOR 0x1022
#define AMD_SFH_HID_PRODUCT 0x0001
...
...
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
浏览文件 @
8959f007
...
...
@@ -130,6 +130,12 @@ static int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
return
0
;
}
static
int
amd_sfh_dis_sts_v2
(
struct
amd_mp2_dev
*
privdata
)
{
return
(
readl
(
privdata
->
mmio
+
AMD_P2C_MSG
(
1
))
&
SENSOR_DISCOVERY_STATUS_MASK
)
>>
SENSOR_DISCOVERY_STATUS_SHIFT
;
}
void
amd_start_sensor
(
struct
amd_mp2_dev
*
privdata
,
struct
amd_mp2_sensor_info
info
)
{
union
sfh_cmd_param
cmd_param
;
...
...
@@ -245,6 +251,7 @@ static const struct amd_mp2_ops amd_sfh_ops_v2 = {
.
response
=
amd_sfh_wait_response_v2
,
.
clear_intr
=
amd_sfh_clear_intr_v2
,
.
init_intr
=
amd_sfh_irq_init_v2
,
.
discovery_status
=
amd_sfh_dis_sts_v2
,
};
static
const
struct
amd_mp2_ops
amd_sfh_ops
=
{
...
...
@@ -346,8 +353,9 @@ static int __maybe_unused amd_mp2_pci_resume(struct device *dev)
(
mp2
,
cl_data
->
sensor_idx
[
i
],
SENSOR_ENABLED
);
if
(
status
==
SENSOR_ENABLED
)
cl_data
->
sensor_sts
[
i
]
=
SENSOR_ENABLED
;
dev_dbg
(
dev
,
"resume sid 0x%x status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
cl_data
->
sensor_sts
[
i
]);
dev_dbg
(
dev
,
"suspend sid 0x%x (%s) status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
get_sensor_name
(
cl_data
->
sensor_idx
[
i
]),
cl_data
->
sensor_sts
[
i
]);
}
}
...
...
@@ -371,8 +379,9 @@ static int __maybe_unused amd_mp2_pci_suspend(struct device *dev)
(
mp2
,
cl_data
->
sensor_idx
[
i
],
SENSOR_DISABLED
);
if
(
status
!=
SENSOR_ENABLED
)
cl_data
->
sensor_sts
[
i
]
=
SENSOR_DISABLED
;
dev_dbg
(
dev
,
"suspend sid 0x%x status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
cl_data
->
sensor_sts
[
i
]);
dev_dbg
(
dev
,
"suspend sid 0x%x (%s) status 0x%x
\n
"
,
cl_data
->
sensor_idx
[
i
],
get_sensor_name
(
cl_data
->
sensor_idx
[
i
]),
cl_data
->
sensor_sts
[
i
]);
}
}
...
...
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
浏览文件 @
8959f007
...
...
@@ -39,6 +39,9 @@
#define AMD_SFH_IDLE_LOOP 200
#define SENSOR_DISCOVERY_STATUS_MASK GENMASK(5, 3)
#define SENSOR_DISCOVERY_STATUS_SHIFT 3
/* SFH Command register */
union
sfh_cmd_base
{
u32
ul
;
...
...
@@ -135,6 +138,7 @@ int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata);
u32
amd_sfh_wait_for_response
(
struct
amd_mp2_dev
*
mp2
,
u8
sid
,
u32
sensor_sts
);
void
amd_mp2_suspend
(
struct
amd_mp2_dev
*
mp2
);
void
amd_mp2_resume
(
struct
amd_mp2_dev
*
mp2
);
const
char
*
get_sensor_name
(
int
idx
);
struct
amd_mp2_ops
{
void
(
*
start
)(
struct
amd_mp2_dev
*
privdata
,
struct
amd_mp2_sensor_info
info
);
...
...
@@ -143,5 +147,6 @@ struct amd_mp2_ops {
int
(
*
response
)(
struct
amd_mp2_dev
*
mp2
,
u8
sid
,
u32
sensor_sts
);
void
(
*
clear_intr
)(
struct
amd_mp2_dev
*
privdata
);
int
(
*
init_intr
)(
struct
amd_mp2_dev
*
privdata
);
int
(
*
discovery_status
)(
struct
amd_mp2_dev
*
privdata
);
};
#endif
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
浏览文件 @
8959f007
...
...
@@ -179,7 +179,7 @@ static const u8 accel3_report_descriptor[] = {
0xC0
/* HID end collection */
};
const
u8
gyro3_report_descriptor
[]
=
{
static
const
u8
gyro3_report_descriptor
[]
=
{
0x05
,
0x20
,
/* Usage page */
0x09
,
0x76
,
/* Motion type Gyro3D */
0xA1
,
0x00
,
/* HID Collection (Physical) */
...
...
@@ -340,7 +340,7 @@ const u8 gyro3_report_descriptor[] = {
0xC0
,
/* HID end collection */
};
const
u8
comp3_report_descriptor
[]
=
{
static
const
u8
comp3_report_descriptor
[]
=
{
0x05
,
0x20
,
/* Usage page */
0x09
,
0x83
,
/* Motion type Orientation compass 3D */
0xA1
,
0x00
,
/* HID Collection (Physical) */
...
...
@@ -512,7 +512,7 @@ const u8 comp3_report_descriptor[] = {
0xC0
/* HID end collection */
};
const
u8
als_report_descriptor
[]
=
{
static
const
u8
als_report_descriptor
[]
=
{
0x05
,
0x20
,
/* HID usage page sensor */
0x09
,
0x41
,
/* HID usage sensor type Ambientlight */
0xA1
,
0x00
,
/* HID Collection (Physical) */
...
...
drivers/hid/hid-core.c
浏览文件 @
8959f007
...
...
@@ -2222,6 +2222,10 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
case
BUS_VIRTUAL
:
bus
=
"VIRTUAL"
;
break
;
case
BUS_INTEL_ISHTP
:
case
BUS_AMD_SFH
:
bus
=
"SENSOR HUB"
;
break
;
default:
bus
=
"<UNKNOWN>"
;
}
...
...
include/uapi/linux/input.h
浏览文件 @
8959f007
...
...
@@ -271,6 +271,7 @@ struct input_mask {
#define BUS_RMI 0x1D
#define BUS_CEC 0x1E
#define BUS_INTEL_ISHTP 0x1F
#define BUS_AMD_SFH 0x20
/*
* MT_TOOL types
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录