2 * This file is part of the coreboot project.
4 * Copyright (C) 2016 Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <arch/acpigen_dsm.h>
17 #include <device/device.h>
21 static void i2c_alps_fill_dsm(struct device
*dev
)
23 struct drivers_i2c_alps_config
*config
= dev
->chip_info
;
24 struct dsm_i2c_hid_config dsm_config
= {
25 .hid_desc_reg_offset
= config
->hid_desc_reg_offset
,
28 acpigen_write_dsm_i2c_hid(&dsm_config
);
31 static void i2c_alps_fill_ssdt_generator(struct device
*dev
)
33 struct drivers_i2c_alps_config
*config
= dev
->chip_info
;
34 i2c_generic_fill_ssdt(dev
, &i2c_alps_fill_dsm
, &config
->generic
);
37 static const char *i2c_alps_acpi_name(const struct device
*dev
)
42 static struct device_operations i2c_alps_ops
= {
43 .read_resources
= DEVICE_NOOP
,
44 .set_resources
= DEVICE_NOOP
,
45 .enable_resources
= DEVICE_NOOP
,
46 #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
47 .acpi_name
= &i2c_alps_acpi_name
,
48 .acpi_fill_ssdt_generator
= &i2c_alps_fill_ssdt_generator
,
52 static void i2c_alps_enable(struct device
*dev
)
54 dev
->ops
= &i2c_alps_ops
;
57 struct chip_operations drivers_i2c_alps_ops
= {
58 CHIP_NAME("ALPS I2C Device")
59 .enable_dev
= &i2c_alps_enable