1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi_device.h>
4 #include <acpi/acpigen.h>
5 #include <console/console.h>
6 #include <device/device.h>
11 static const char *i2c_gpiomux_bus_acpi_name(const struct device
*dev
)
13 static char name
[ACPI_NAME_BUFFER_SIZE
];
15 snprintf(name
, ACPI_NAME_BUFFER_SIZE
, "MXA%01.1X", dev
->path
.generic
.id
);
19 static void i2c_gpiomux_bus_fill_ssdt(const struct device
*dev
)
21 const char *scope
= acpi_device_scope(dev
);
22 const char *path
= acpi_device_path(dev
);
24 if (!dev
|| !scope
|| !path
)
28 acpigen_write_scope(scope
);
29 acpigen_write_device(acpi_device_name(dev
));
31 acpigen_write_STA(acpi_device_status(dev
));
32 acpigen_write_ADR(dev
->path
.generic
.id
);
34 acpigen_pop_len(); /* Device */
35 acpigen_pop_len(); /* Scope */
37 printk(BIOS_INFO
, "%s: %s at %s\n", path
, dev
->chip_ops
->name
, dev_path(dev
));
40 static struct device_operations i2c_gpiomux_bus_ops
= {
41 .read_resources
= noop_read_resources
,
42 .set_resources
= noop_set_resources
,
43 .scan_bus
= scan_static_bus
,
44 .acpi_name
= i2c_gpiomux_bus_acpi_name
,
45 .acpi_fill_ssdt
= i2c_gpiomux_bus_fill_ssdt
,
48 static void i2c_gpiomux_bus_enable(struct device
*dev
)
53 dev
->ops
= &i2c_gpiomux_bus_ops
;
56 struct chip_operations drivers_i2c_gpiomux_bus_ops
= {
57 .name
= "I2C GPIO MUX Bus Device",
58 .enable_dev
= i2c_gpiomux_bus_enable