Loading drivers/acpi/scan.c +33 −4 Original line number Diff line number Diff line Loading @@ -797,6 +797,12 @@ static const char * const acpi_ignore_dep_ids[] = { NULL }; /* List of HIDs for which we honor deps of matching ACPI devs, when checking _DEP lists. */ static const char * const acpi_honor_dep_ids[] = { "INT3472", /* Camera sensor PMIC / clk and regulator info */ NULL }; static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) { struct acpi_device *device = NULL; Loading Loading @@ -1762,10 +1768,14 @@ static void acpi_scan_dep_init(struct acpi_device *adev) struct acpi_dep_data *dep; list_for_each_entry(dep, &acpi_dep_list, node) { if (dep->consumer == adev->handle) if (dep->consumer == adev->handle) { if (dep->honor_dep) adev->flags.honor_deps = 1; adev->dep_unmet++; } } } void acpi_device_add_finalize(struct acpi_device *device) { Loading Loading @@ -1967,7 +1977,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep) for (count = 0, i = 0; i < dep_devices.count; i++) { struct acpi_device_info *info; struct acpi_dep_data *dep; bool skip; bool skip, honor_dep; status = acpi_get_object_info(dep_devices.handles[i], &info); if (ACPI_FAILURE(status)) { Loading @@ -1976,6 +1986,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep) } skip = acpi_info_matches_ids(info, acpi_ignore_dep_ids); honor_dep = acpi_info_matches_ids(info, acpi_honor_dep_ids); kfree(info); if (skip) Loading @@ -1989,6 +2000,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep) dep->supplier = dep_devices.handles[i]; dep->consumer = handle; dep->honor_dep = honor_dep; mutex_lock(&acpi_dep_list_lock); list_add_tail(&dep->node , &acpi_dep_list); Loading Loading @@ -2155,8 +2167,8 @@ static void acpi_bus_attach(struct acpi_device *device, bool first_pass) register_dock_dependent_device(device, ejd); acpi_bus_get_status(device); /* Skip devices that are not present. */ if (!acpi_device_is_present(device)) { /* Skip devices that are not ready for enumeration (e.g. not present) */ if (!acpi_dev_ready_for_enumeration(device)) { device->flags.initialized = false; acpi_device_clear_enumerated(device); device->flags.power_manageable = 0; Loading Loading @@ -2318,6 +2330,23 @@ void acpi_dev_clear_dependencies(struct acpi_device *supplier) } EXPORT_SYMBOL_GPL(acpi_dev_clear_dependencies); /** * acpi_dev_ready_for_enumeration - Check if the ACPI device is ready for enumeration * @device: Pointer to the &struct acpi_device to check * * Check if the device is present and has no unmet dependencies. * * Return true if the device is ready for enumeratino. Otherwise, return false. */ bool acpi_dev_ready_for_enumeration(const struct acpi_device *device) { if (device->flags.honor_deps && device->dep_unmet) return false; return acpi_device_is_present(device); } EXPORT_SYMBOL_GPL(acpi_dev_ready_for_enumeration); /** * acpi_dev_get_first_consumer_dev - Return ACPI device dependent on @supplier * @supplier: Pointer to the dependee device Loading drivers/i2c/i2c-core-acpi.c +15 −7 Original line number Diff line number Diff line Loading @@ -144,9 +144,12 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, struct list_head resource_list; int ret; if (acpi_bus_get_status(adev) || !adev->status.present) if (acpi_bus_get_status(adev)) return -EINVAL; if (!acpi_dev_ready_for_enumeration(adev)) return -ENODEV; if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0) return -ENODEV; Loading Loading @@ -473,8 +476,8 @@ struct notifier_block i2c_acpi_notifier = { }; /** * i2c_acpi_new_device - Create i2c-client for the Nth I2cSerialBus resource * @dev: Device owning the ACPI resources to get the client from * i2c_acpi_new_device_by_fwnode - Create i2c-client for the Nth I2cSerialBus resource * @fwnode: fwnode with the ACPI resources to get the client from * @index: Index of ACPI resource to get * @info: describes the I2C device; note this is modified (addr gets set) * Context: can sleep Loading @@ -490,15 +493,20 @@ struct notifier_block i2c_acpi_notifier = { * Returns a pointer to the new i2c-client, or error pointer in case of failure. * Specifically, -EPROBE_DEFER is returned if the adapter is not found. */ struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, struct i2c_client *i2c_acpi_new_device_by_fwnode(struct fwnode_handle *fwnode, int index, struct i2c_board_info *info) { struct acpi_device *adev = ACPI_COMPANION(dev); struct i2c_acpi_lookup lookup; struct i2c_adapter *adapter; struct acpi_device *adev; LIST_HEAD(resource_list); int ret; adev = to_acpi_device_node(fwnode); if (!adev) return ERR_PTR(-ENODEV); memset(&lookup, 0, sizeof(lookup)); lookup.info = info; lookup.device_handle = acpi_device_handle(adev); Loading @@ -520,7 +528,7 @@ struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, return i2c_new_client_device(adapter, info); } EXPORT_SYMBOL_GPL(i2c_acpi_new_device); EXPORT_SYMBOL_GPL(i2c_acpi_new_device_by_fwnode); bool i2c_acpi_waive_d0_probe(struct device *dev) { Loading drivers/platform/x86/intel/int3472/Makefile +4 −5 Original line number Diff line number Diff line obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472.o intel_skl_int3472-y := intel_skl_int3472_common.o \ intel_skl_int3472_discrete.o \ intel_skl_int3472_tps68470.o \ intel_skl_int3472_clk_and_regulator.o obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \ intel_skl_int3472_tps68470.o intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o common.o intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o common.o drivers/platform/x86/intel/int3472/intel_skl_int3472_clk_and_regulator.c→drivers/platform/x86/intel/int3472/clk_and_regulator.c +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ #include <linux/regulator/driver.h> #include <linux/slab.h> #include "intel_skl_int3472_common.h" #include "common.h" /* * The regulators have to have .ops to be valid, but the only ops we actually Loading drivers/platform/x86/intel/int3472/intel_skl_int3472_common.c→drivers/platform/x86/intel/int3472/common.c +82 −0 Original line number Diff line number Diff line Loading @@ -2,11 +2,9 @@ /* Author: Dan Scally <djrscally@gmail.com> */ #include <linux/acpi.h> #include <linux/i2c.h> #include <linux/platform_device.h> #include <linux/slab.h> #include "intel_skl_int3472_common.h" #include "common.h" union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev, char *id) { Loading Loading @@ -55,52 +53,30 @@ int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb) return ret; } static const struct acpi_device_id int3472_device_id[] = { { "INT3472", 0 }, { } }; MODULE_DEVICE_TABLE(acpi, int3472_device_id); static struct platform_driver int3472_discrete = { .driver = { .name = "int3472-discrete", .acpi_match_table = int3472_device_id, }, .probe = skl_int3472_discrete_probe, .remove = skl_int3472_discrete_remove, }; static struct i2c_driver int3472_tps68470 = { .driver = { .name = "int3472-tps68470", .acpi_match_table = int3472_device_id, }, .probe_new = skl_int3472_tps68470_probe, }; static int skl_int3472_init(void) /* sensor_adev_ret may be NULL, name_ret must not be NULL */ int skl_int3472_get_sensor_adev_and_name(struct device *dev, struct acpi_device **sensor_adev_ret, const char **name_ret) { int ret; struct acpi_device *adev = ACPI_COMPANION(dev); struct acpi_device *sensor; int ret = 0; sensor = acpi_dev_get_first_consumer_dev(adev); if (!sensor) { dev_err(dev, "INT3472 seems to have no dependents.\n"); return -ENODEV; } ret = platform_driver_register(&int3472_discrete); if (ret) return ret; *name_ret = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT, acpi_dev_name(sensor)); if (!*name_ret) ret = -ENOMEM; ret = i2c_register_driver(THIS_MODULE, &int3472_tps68470); if (ret) platform_driver_unregister(&int3472_discrete); if (ret == 0 && sensor_adev_ret) *sensor_adev_ret = sensor; else acpi_dev_put(sensor); return ret; } module_init(skl_int3472_init); static void skl_int3472_exit(void) { platform_driver_unregister(&int3472_discrete); i2c_del_driver(&int3472_tps68470); } module_exit(skl_int3472_exit); MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI Device Driver"); MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); MODULE_LICENSE("GPL v2"); Loading
drivers/acpi/scan.c +33 −4 Original line number Diff line number Diff line Loading @@ -797,6 +797,12 @@ static const char * const acpi_ignore_dep_ids[] = { NULL }; /* List of HIDs for which we honor deps of matching ACPI devs, when checking _DEP lists. */ static const char * const acpi_honor_dep_ids[] = { "INT3472", /* Camera sensor PMIC / clk and regulator info */ NULL }; static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) { struct acpi_device *device = NULL; Loading Loading @@ -1762,10 +1768,14 @@ static void acpi_scan_dep_init(struct acpi_device *adev) struct acpi_dep_data *dep; list_for_each_entry(dep, &acpi_dep_list, node) { if (dep->consumer == adev->handle) if (dep->consumer == adev->handle) { if (dep->honor_dep) adev->flags.honor_deps = 1; adev->dep_unmet++; } } } void acpi_device_add_finalize(struct acpi_device *device) { Loading Loading @@ -1967,7 +1977,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep) for (count = 0, i = 0; i < dep_devices.count; i++) { struct acpi_device_info *info; struct acpi_dep_data *dep; bool skip; bool skip, honor_dep; status = acpi_get_object_info(dep_devices.handles[i], &info); if (ACPI_FAILURE(status)) { Loading @@ -1976,6 +1986,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep) } skip = acpi_info_matches_ids(info, acpi_ignore_dep_ids); honor_dep = acpi_info_matches_ids(info, acpi_honor_dep_ids); kfree(info); if (skip) Loading @@ -1989,6 +2000,7 @@ static u32 acpi_scan_check_dep(acpi_handle handle, bool check_dep) dep->supplier = dep_devices.handles[i]; dep->consumer = handle; dep->honor_dep = honor_dep; mutex_lock(&acpi_dep_list_lock); list_add_tail(&dep->node , &acpi_dep_list); Loading Loading @@ -2155,8 +2167,8 @@ static void acpi_bus_attach(struct acpi_device *device, bool first_pass) register_dock_dependent_device(device, ejd); acpi_bus_get_status(device); /* Skip devices that are not present. */ if (!acpi_device_is_present(device)) { /* Skip devices that are not ready for enumeration (e.g. not present) */ if (!acpi_dev_ready_for_enumeration(device)) { device->flags.initialized = false; acpi_device_clear_enumerated(device); device->flags.power_manageable = 0; Loading Loading @@ -2318,6 +2330,23 @@ void acpi_dev_clear_dependencies(struct acpi_device *supplier) } EXPORT_SYMBOL_GPL(acpi_dev_clear_dependencies); /** * acpi_dev_ready_for_enumeration - Check if the ACPI device is ready for enumeration * @device: Pointer to the &struct acpi_device to check * * Check if the device is present and has no unmet dependencies. * * Return true if the device is ready for enumeratino. Otherwise, return false. */ bool acpi_dev_ready_for_enumeration(const struct acpi_device *device) { if (device->flags.honor_deps && device->dep_unmet) return false; return acpi_device_is_present(device); } EXPORT_SYMBOL_GPL(acpi_dev_ready_for_enumeration); /** * acpi_dev_get_first_consumer_dev - Return ACPI device dependent on @supplier * @supplier: Pointer to the dependee device Loading
drivers/i2c/i2c-core-acpi.c +15 −7 Original line number Diff line number Diff line Loading @@ -144,9 +144,12 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, struct list_head resource_list; int ret; if (acpi_bus_get_status(adev) || !adev->status.present) if (acpi_bus_get_status(adev)) return -EINVAL; if (!acpi_dev_ready_for_enumeration(adev)) return -ENODEV; if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0) return -ENODEV; Loading Loading @@ -473,8 +476,8 @@ struct notifier_block i2c_acpi_notifier = { }; /** * i2c_acpi_new_device - Create i2c-client for the Nth I2cSerialBus resource * @dev: Device owning the ACPI resources to get the client from * i2c_acpi_new_device_by_fwnode - Create i2c-client for the Nth I2cSerialBus resource * @fwnode: fwnode with the ACPI resources to get the client from * @index: Index of ACPI resource to get * @info: describes the I2C device; note this is modified (addr gets set) * Context: can sleep Loading @@ -490,15 +493,20 @@ struct notifier_block i2c_acpi_notifier = { * Returns a pointer to the new i2c-client, or error pointer in case of failure. * Specifically, -EPROBE_DEFER is returned if the adapter is not found. */ struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, struct i2c_client *i2c_acpi_new_device_by_fwnode(struct fwnode_handle *fwnode, int index, struct i2c_board_info *info) { struct acpi_device *adev = ACPI_COMPANION(dev); struct i2c_acpi_lookup lookup; struct i2c_adapter *adapter; struct acpi_device *adev; LIST_HEAD(resource_list); int ret; adev = to_acpi_device_node(fwnode); if (!adev) return ERR_PTR(-ENODEV); memset(&lookup, 0, sizeof(lookup)); lookup.info = info; lookup.device_handle = acpi_device_handle(adev); Loading @@ -520,7 +528,7 @@ struct i2c_client *i2c_acpi_new_device(struct device *dev, int index, return i2c_new_client_device(adapter, info); } EXPORT_SYMBOL_GPL(i2c_acpi_new_device); EXPORT_SYMBOL_GPL(i2c_acpi_new_device_by_fwnode); bool i2c_acpi_waive_d0_probe(struct device *dev) { Loading
drivers/platform/x86/intel/int3472/Makefile +4 −5 Original line number Diff line number Diff line obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472.o intel_skl_int3472-y := intel_skl_int3472_common.o \ intel_skl_int3472_discrete.o \ intel_skl_int3472_tps68470.o \ intel_skl_int3472_clk_and_regulator.o obj-$(CONFIG_INTEL_SKL_INT3472) += intel_skl_int3472_discrete.o \ intel_skl_int3472_tps68470.o intel_skl_int3472_discrete-y := discrete.o clk_and_regulator.o common.o intel_skl_int3472_tps68470-y := tps68470.o tps68470_board_data.o common.o
drivers/platform/x86/intel/int3472/intel_skl_int3472_clk_and_regulator.c→drivers/platform/x86/intel/int3472/clk_and_regulator.c +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ #include <linux/regulator/driver.h> #include <linux/slab.h> #include "intel_skl_int3472_common.h" #include "common.h" /* * The regulators have to have .ops to be valid, but the only ops we actually Loading
drivers/platform/x86/intel/int3472/intel_skl_int3472_common.c→drivers/platform/x86/intel/int3472/common.c +82 −0 Original line number Diff line number Diff line Loading @@ -2,11 +2,9 @@ /* Author: Dan Scally <djrscally@gmail.com> */ #include <linux/acpi.h> #include <linux/i2c.h> #include <linux/platform_device.h> #include <linux/slab.h> #include "intel_skl_int3472_common.h" #include "common.h" union acpi_object *skl_int3472_get_acpi_buffer(struct acpi_device *adev, char *id) { Loading Loading @@ -55,52 +53,30 @@ int skl_int3472_fill_cldb(struct acpi_device *adev, struct int3472_cldb *cldb) return ret; } static const struct acpi_device_id int3472_device_id[] = { { "INT3472", 0 }, { } }; MODULE_DEVICE_TABLE(acpi, int3472_device_id); static struct platform_driver int3472_discrete = { .driver = { .name = "int3472-discrete", .acpi_match_table = int3472_device_id, }, .probe = skl_int3472_discrete_probe, .remove = skl_int3472_discrete_remove, }; static struct i2c_driver int3472_tps68470 = { .driver = { .name = "int3472-tps68470", .acpi_match_table = int3472_device_id, }, .probe_new = skl_int3472_tps68470_probe, }; static int skl_int3472_init(void) /* sensor_adev_ret may be NULL, name_ret must not be NULL */ int skl_int3472_get_sensor_adev_and_name(struct device *dev, struct acpi_device **sensor_adev_ret, const char **name_ret) { int ret; struct acpi_device *adev = ACPI_COMPANION(dev); struct acpi_device *sensor; int ret = 0; sensor = acpi_dev_get_first_consumer_dev(adev); if (!sensor) { dev_err(dev, "INT3472 seems to have no dependents.\n"); return -ENODEV; } ret = platform_driver_register(&int3472_discrete); if (ret) return ret; *name_ret = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT, acpi_dev_name(sensor)); if (!*name_ret) ret = -ENOMEM; ret = i2c_register_driver(THIS_MODULE, &int3472_tps68470); if (ret) platform_driver_unregister(&int3472_discrete); if (ret == 0 && sensor_adev_ret) *sensor_adev_ret = sensor; else acpi_dev_put(sensor); return ret; } module_init(skl_int3472_init); static void skl_int3472_exit(void) { platform_driver_unregister(&int3472_discrete); i2c_del_driver(&int3472_tps68470); } module_exit(skl_int3472_exit); MODULE_DESCRIPTION("Intel SkyLake INT3472 ACPI Device Driver"); MODULE_AUTHOR("Daniel Scally <djrscally@gmail.com>"); MODULE_LICENSE("GPL v2");