Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
72d0beb4
Commit
72d0beb4
authored
Jun 08, 2018
by
Jiri Kosina
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-4.18/i2c-hid' into for-linus
Assorted smaller fixes to i2c-hid driver
parents
37acd687
d44c2816
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
drivers/hid/i2c-hid/i2c-hid.c
drivers/hid/i2c-hid/i2c-hid.c
+25
-8
No files found.
drivers/hid/i2c-hid/i2c-hid.c
View file @
72d0beb4
...
@@ -131,8 +131,6 @@ static const struct i2c_hid_cmd hid_no_cmd = { .length = 0 };
...
@@ -131,8 +131,6 @@ static const struct i2c_hid_cmd hid_no_cmd = { .length = 0 };
* static const struct i2c_hid_cmd hid_set_protocol_cmd = { I2C_HID_CMD(0x07) };
* static const struct i2c_hid_cmd hid_set_protocol_cmd = { I2C_HID_CMD(0x07) };
*/
*/
static
DEFINE_MUTEX
(
i2c_hid_open_mut
);
/* The main device structure */
/* The main device structure */
struct
i2c_hid
{
struct
i2c_hid
{
struct
i2c_client
*
client
;
/* i2c client */
struct
i2c_client
*
client
;
/* i2c client */
...
@@ -868,6 +866,15 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
...
@@ -868,6 +866,15 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
}
}
#ifdef CONFIG_ACPI
#ifdef CONFIG_ACPI
static
const
struct
acpi_device_id
i2c_hid_acpi_blacklist
[]
=
{
/*
* The CHPN0001 ACPI device, which is used to describe the Chipone
* ICN8505 controller, has a _CID of PNP0C50 but is not HID compatible.
*/
{
"CHPN0001"
,
0
},
{
},
};
static
int
i2c_hid_acpi_pdata
(
struct
i2c_client
*
client
,
static
int
i2c_hid_acpi_pdata
(
struct
i2c_client
*
client
,
struct
i2c_hid_platform_data
*
pdata
)
struct
i2c_hid_platform_data
*
pdata
)
{
{
...
@@ -879,13 +886,18 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
...
@@ -879,13 +886,18 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
acpi_handle
handle
;
acpi_handle
handle
;
handle
=
ACPI_HANDLE
(
&
client
->
dev
);
handle
=
ACPI_HANDLE
(
&
client
->
dev
);
if
(
!
handle
||
acpi_bus_get_device
(
handle
,
&
adev
))
if
(
!
handle
||
acpi_bus_get_device
(
handle
,
&
adev
))
{
dev_err
(
&
client
->
dev
,
"Error could not get ACPI device
\n
"
);
return
-
ENODEV
;
}
if
(
acpi_match_device_ids
(
adev
,
i2c_hid_acpi_blacklist
)
==
0
)
return
-
ENODEV
;
return
-
ENODEV
;
obj
=
acpi_evaluate_dsm_typed
(
handle
,
&
i2c_hid_guid
,
1
,
1
,
NULL
,
obj
=
acpi_evaluate_dsm_typed
(
handle
,
&
i2c_hid_guid
,
1
,
1
,
NULL
,
ACPI_TYPE_INTEGER
);
ACPI_TYPE_INTEGER
);
if
(
!
obj
)
{
if
(
!
obj
)
{
dev_err
(
&
client
->
dev
,
"
device _DSM execution
failed
\n
"
);
dev_err
(
&
client
->
dev
,
"
Error _DSM call to get HID descriptor address
failed
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
@@ -1000,11 +1012,8 @@ static int i2c_hid_probe(struct i2c_client *client,
...
@@ -1000,11 +1012,8 @@ static int i2c_hid_probe(struct i2c_client *client,
goto
err
;
goto
err
;
}
else
if
(
!
platform_data
)
{
}
else
if
(
!
platform_data
)
{
ret
=
i2c_hid_acpi_pdata
(
client
,
&
ihid
->
pdata
);
ret
=
i2c_hid_acpi_pdata
(
client
,
&
ihid
->
pdata
);
if
(
ret
)
{
if
(
ret
)
dev_err
(
&
client
->
dev
,
"HID register address not provided
\n
"
);
goto
err
;
goto
err
;
}
}
else
{
}
else
{
ihid
->
pdata
=
*
platform_data
;
ihid
->
pdata
=
*
platform_data
;
}
}
...
@@ -1054,6 +1063,14 @@ static int i2c_hid_probe(struct i2c_client *client,
...
@@ -1054,6 +1063,14 @@ static int i2c_hid_probe(struct i2c_client *client,
pm_runtime_enable
(
&
client
->
dev
);
pm_runtime_enable
(
&
client
->
dev
);
device_enable_async_suspend
(
&
client
->
dev
);
device_enable_async_suspend
(
&
client
->
dev
);
/* Make sure there is something at this address */
ret
=
i2c_smbus_read_byte
(
client
);
if
(
ret
<
0
)
{
dev_dbg
(
&
client
->
dev
,
"nothing at this address: %d
\n
"
,
ret
);
ret
=
-
ENXIO
;
goto
err_pm
;
}
ret
=
i2c_hid_fetch_hid_descriptor
(
ihid
);
ret
=
i2c_hid_fetch_hid_descriptor
(
ihid
);
if
(
ret
<
0
)
if
(
ret
<
0
)
goto
err_pm
;
goto
err_pm
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment