1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- From 14bc7782c703218156fe5fd6b8df97a5f25f8d3e Mon Sep 17 00:00:00 2001
- From: Maximilian Luz <luzmaximilian@gmail.com>
- Date: Sat, 25 Jul 2020 17:19:53 +0200
- Subject: [PATCH 4/6] surface-sam-over-hid
- ---
- drivers/i2c/i2c-core-acpi.c | 35 +++++++++++++++++++++++++++++++++++
- 1 file changed, 35 insertions(+)
- diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
- index ce70b5288472c..5df647c4d9a51 100644
- --- a/drivers/i2c/i2c-core-acpi.c
- +++ b/drivers/i2c/i2c-core-acpi.c
- @@ -582,6 +582,28 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
- return (ret == 1) ? 0 : -EIO;
- }
-
- +static int acpi_gsb_i2c_write_raw_bytes(struct i2c_client *client,
- + u8 *data, u8 data_len)
- +{
- + struct i2c_msg msgs[1];
- + int ret = AE_OK;
- +
- + msgs[0].addr = client->addr;
- + msgs[0].flags = client->flags;
- + msgs[0].len = data_len + 1;
- + msgs[0].buf = data;
- +
- + ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
- +
- + if (ret < 0) {
- + dev_err(&client->adapter->dev, "i2c write failed: %d\n", ret);
- + return ret;
- + }
- +
- + /* 1 transfer must have completed successfully */
- + return (ret == 1) ? 0 : -EIO;
- +}
- +
- static acpi_status
- i2c_acpi_space_handler(u32 function, acpi_physical_address command,
- u32 bits, u64 *value64,
- @@ -683,6 +705,19 @@ i2c_acpi_space_handler(u32 function, acpi_physical_address command,
- }
- break;
-
- + case ACPI_GSB_ACCESS_ATTRIB_RAW_BYTES:
- + if (action == ACPI_READ) {
- + dev_warn(&adapter->dev,
- + "protocol 0x%02x not supported for client 0x%02x\n",
- + accessor_type, client->addr);
- + ret = AE_BAD_PARAMETER;
- + goto err;
- + } else {
- + status = acpi_gsb_i2c_write_raw_bytes(client,
- + gsb->data, info->access_length);
- + }
- + break;
- +
- default:
- dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n",
- accessor_type, client->addr);
- --
- 2.28.0
|