drivers/i2c/hid: Use ACPI device name if provided by config

Follow model of drivers/i2c/generic and use user-supplied device
name if specified in the chip config.

Change-Id: Ia783bac2797e239989c03a3421b9293a055db3d0
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47782
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Matt DeVillier 2020-11-19 18:31:17 -06:00 committed by Patrick Georgi
parent 86dce8fa75
commit 3d62781acb
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,10 @@ static void i2c_hid_fill_ssdt_generator(const struct device *dev)
static const char *i2c_hid_acpi_name(const struct device *dev)
{
static char name[5];
struct drivers_i2c_hid_config *config = dev->chip_info;
if (config->generic.name)
return config->generic.name;
snprintf(name, sizeof(name), "H%03.3X", dev->path.i2c.device);
name[4] = '\0';
return name;