diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-08-09 16:21:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-08-09 16:21:28 -0400 |
commit | 358f8c26b15daf16859cb3bd33db7e601707200e (patch) | |
tree | 9ce40690da91c21794592a02387039c35032622c | |
parent | 31cf92f3dda8ecf4ce19761847cad6e1ffa144e1 (diff) | |
parent | 9c80034921d1ece5c0e3241ba1645bce32387684 (diff) |
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang:
"The main thing is to allow empty id_tables for ACPI to make some
drivers get probed again. It looks a bit bigger than usual because it
needs some internal renaming, too.
Other than that, there is a fix for broken DSTDs, a super simple
enablement for ARM MPS, and two documentation fixes which I'd like to
see in v4.13 already"
* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: rephrase explanation of I2C_CLASS_DEPRECATED
i2c: allow i2c-versatile for ARM MPS platforms
i2c: designware: Some broken DSTDs use 1MiHz instead of 1MHz
i2c: designware: Print clock freq on invalid clock freq error
i2c: core: Allow empty id_table in ACPI case as well
i2c: mux: pinctrl: mention correct module name in Kconfig help text
-rw-r--r-- | drivers/i2c/busses/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 6 | ||||
-rw-r--r-- | drivers/i2c/i2c-core-acpi.c | 19 | ||||
-rw-r--r-- | drivers/i2c/i2c-core-base.c | 1 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.h | 9 | ||||
-rw-r--r-- | drivers/i2c/muxes/Kconfig | 2 | ||||
-rw-r--r-- | include/linux/i2c.h | 3 |
7 files changed, 34 insertions, 8 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 1006b230b236..65fa29591d21 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -983,7 +983,7 @@ config I2C_UNIPHIER_F | |||
983 | 983 | ||
984 | config I2C_VERSATILE | 984 | config I2C_VERSATILE |
985 | tristate "ARM Versatile/Realview I2C bus support" | 985 | tristate "ARM Versatile/Realview I2C bus support" |
986 | depends on ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS || COMPILE_TEST | 986 | depends on ARCH_MPS2 || ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS || COMPILE_TEST |
987 | select I2C_ALGOBIT | 987 | select I2C_ALGOBIT |
988 | help | 988 | help |
989 | Say yes if you want to support the I2C serial bus on ARMs Versatile | 989 | Say yes if you want to support the I2C serial bus on ARMs Versatile |
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 2ea6d0d25a01..143a8fd582b4 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -298,6 +298,9 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) | |||
298 | } | 298 | } |
299 | 299 | ||
300 | acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev); | 300 | acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev); |
301 | /* Some broken DSTDs use 1MiHz instead of 1MHz */ | ||
302 | if (acpi_speed == 1048576) | ||
303 | acpi_speed = 1000000; | ||
301 | /* | 304 | /* |
302 | * Find bus speed from the "clock-frequency" device property, ACPI | 305 | * Find bus speed from the "clock-frequency" device property, ACPI |
303 | * or by using fast mode if neither is set. | 306 | * or by using fast mode if neither is set. |
@@ -319,7 +322,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) | |||
319 | if (dev->clk_freq != 100000 && dev->clk_freq != 400000 | 322 | if (dev->clk_freq != 100000 && dev->clk_freq != 400000 |
320 | && dev->clk_freq != 1000000 && dev->clk_freq != 3400000) { | 323 | && dev->clk_freq != 1000000 && dev->clk_freq != 3400000) { |
321 | dev_err(&pdev->dev, | 324 | dev_err(&pdev->dev, |
322 | "Only 100kHz, 400kHz, 1MHz and 3.4MHz supported"); | 325 | "%d Hz is unsupported, only 100kHz, 400kHz, 1MHz and 3.4MHz are supported\n", |
326 | dev->clk_freq); | ||
323 | ret = -EINVAL; | 327 | ret = -EINVAL; |
324 | goto exit_reset; | 328 | goto exit_reset; |
325 | } | 329 | } |
diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 4842ec3a5451..a9126b3cda61 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c | |||
@@ -230,6 +230,16 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap) | |||
230 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | 230 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); |
231 | } | 231 | } |
232 | 232 | ||
233 | const struct acpi_device_id * | ||
234 | i2c_acpi_match_device(const struct acpi_device_id *matches, | ||
235 | struct i2c_client *client) | ||
236 | { | ||
237 | if (!(client && matches)) | ||
238 | return NULL; | ||
239 | |||
240 | return acpi_match_device(matches, &client->dev); | ||
241 | } | ||
242 | |||
233 | static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level, | 243 | static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level, |
234 | void *data, void **return_value) | 244 | void *data, void **return_value) |
235 | { | 245 | { |
@@ -289,7 +299,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev) | |||
289 | } | 299 | } |
290 | EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); | 300 | EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); |
291 | 301 | ||
292 | static int i2c_acpi_match_adapter(struct device *dev, void *data) | 302 | static int i2c_acpi_find_match_adapter(struct device *dev, void *data) |
293 | { | 303 | { |
294 | struct i2c_adapter *adapter = i2c_verify_adapter(dev); | 304 | struct i2c_adapter *adapter = i2c_verify_adapter(dev); |
295 | 305 | ||
@@ -299,7 +309,7 @@ static int i2c_acpi_match_adapter(struct device *dev, void *data) | |||
299 | return ACPI_HANDLE(dev) == (acpi_handle)data; | 309 | return ACPI_HANDLE(dev) == (acpi_handle)data; |
300 | } | 310 | } |
301 | 311 | ||
302 | static int i2c_acpi_match_device(struct device *dev, void *data) | 312 | static int i2c_acpi_find_match_device(struct device *dev, void *data) |
303 | { | 313 | { |
304 | return ACPI_COMPANION(dev) == data; | 314 | return ACPI_COMPANION(dev) == data; |
305 | } | 315 | } |
@@ -309,7 +319,7 @@ static struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle) | |||
309 | struct device *dev; | 319 | struct device *dev; |
310 | 320 | ||
311 | dev = bus_find_device(&i2c_bus_type, NULL, handle, | 321 | dev = bus_find_device(&i2c_bus_type, NULL, handle, |
312 | i2c_acpi_match_adapter); | 322 | i2c_acpi_find_match_adapter); |
313 | return dev ? i2c_verify_adapter(dev) : NULL; | 323 | return dev ? i2c_verify_adapter(dev) : NULL; |
314 | } | 324 | } |
315 | 325 | ||
@@ -317,7 +327,8 @@ static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev) | |||
317 | { | 327 | { |
318 | struct device *dev; | 328 | struct device *dev; |
319 | 329 | ||
320 | dev = bus_find_device(&i2c_bus_type, NULL, adev, i2c_acpi_match_device); | 330 | dev = bus_find_device(&i2c_bus_type, NULL, adev, |
331 | i2c_acpi_find_match_device); | ||
321 | return dev ? i2c_verify_client(dev) : NULL; | 332 | return dev ? i2c_verify_client(dev) : NULL; |
322 | } | 333 | } |
323 | 334 | ||
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index c89dac7fd2e7..12822a4b8f8f 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c | |||
@@ -357,6 +357,7 @@ static int i2c_device_probe(struct device *dev) | |||
357 | * Tree match table entry is supplied for the probing device. | 357 | * Tree match table entry is supplied for the probing device. |
358 | */ | 358 | */ |
359 | if (!driver->id_table && | 359 | if (!driver->id_table && |
360 | !i2c_acpi_match_device(dev->driver->acpi_match_table, client) && | ||
360 | !i2c_of_match_device(dev->driver->of_match_table, client)) | 361 | !i2c_of_match_device(dev->driver->of_match_table, client)) |
361 | return -ENODEV; | 362 | return -ENODEV; |
362 | 363 | ||
diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h index 3b63f5e5b89c..3d3d9bf02101 100644 --- a/drivers/i2c/i2c-core.h +++ b/drivers/i2c/i2c-core.h | |||
@@ -31,9 +31,18 @@ int i2c_check_addr_validity(unsigned addr, unsigned short flags); | |||
31 | int i2c_check_7bit_addr_validity_strict(unsigned short addr); | 31 | int i2c_check_7bit_addr_validity_strict(unsigned short addr); |
32 | 32 | ||
33 | #ifdef CONFIG_ACPI | 33 | #ifdef CONFIG_ACPI |
34 | const struct acpi_device_id * | ||
35 | i2c_acpi_match_device(const struct acpi_device_id *matches, | ||
36 | struct i2c_client *client); | ||
34 | void i2c_acpi_register_devices(struct i2c_adapter *adap); | 37 | void i2c_acpi_register_devices(struct i2c_adapter *adap); |
35 | #else /* CONFIG_ACPI */ | 38 | #else /* CONFIG_ACPI */ |
36 | static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { } | 39 | static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { } |
40 | static inline const struct acpi_device_id * | ||
41 | i2c_acpi_match_device(const struct acpi_device_id *matches, | ||
42 | struct i2c_client *client) | ||
43 | { | ||
44 | return NULL; | ||
45 | } | ||
37 | #endif /* CONFIG_ACPI */ | 46 | #endif /* CONFIG_ACPI */ |
38 | extern struct notifier_block i2c_acpi_notifier; | 47 | extern struct notifier_block i2c_acpi_notifier; |
39 | 48 | ||
diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index 2c64d0e0740f..17121329bb79 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig | |||
@@ -83,7 +83,7 @@ config I2C_MUX_PINCTRL | |||
83 | different sets of pins at run-time. | 83 | different sets of pins at run-time. |
84 | 84 | ||
85 | This driver can also be built as a module. If so, the module will be | 85 | This driver can also be built as a module. If so, the module will be |
86 | called pinctrl-i2cmux. | 86 | called i2c-mux-pinctrl. |
87 | 87 | ||
88 | config I2C_MUX_REG | 88 | config I2C_MUX_REG |
89 | tristate "Register-based I2C multiplexer" | 89 | tristate "Register-based I2C multiplexer" |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 00ca5b86a753..d501d3956f13 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -689,7 +689,8 @@ i2c_unlock_adapter(struct i2c_adapter *adapter) | |||
689 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ | 689 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ |
690 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 690 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
691 | #define I2C_CLASS_SPD (1<<7) /* Memory modules */ | 691 | #define I2C_CLASS_SPD (1<<7) /* Memory modules */ |
692 | #define I2C_CLASS_DEPRECATED (1<<8) /* Warn users that adapter will stop using classes */ | 692 | /* Warn users that the adapter doesn't support classes anymore */ |
693 | #define I2C_CLASS_DEPRECATED (1<<8) | ||
693 | 694 | ||
694 | /* Internal numbers to terminate lists */ | 695 | /* Internal numbers to terminate lists */ |
695 | #define I2C_CLIENT_END 0xfffeU | 696 | #define I2C_CLIENT_END 0xfffeU |