Skip to content

Commit 358f8c2

Browse files
committed
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
2 parents 31cf92f + 9c80034 commit 358f8c2

File tree

7 files changed

+34
-8
lines changed

7 files changed

+34
-8
lines changed

drivers/i2c/busses/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ config I2C_UNIPHIER_F
983983

984984
config I2C_VERSATILE
985985
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
987987
select I2C_ALGOBIT
988988
help
989989
Say yes if you want to support the I2C serial bus on ARMs Versatile

drivers/i2c/busses/i2c-designware-platdrv.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
298298
}
299299

300300
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;
301304
/*
302305
* Find bus speed from the "clock-frequency" device property, ACPI
303306
* or by using fast mode if neither is set.
@@ -319,7 +322,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
319322
if (dev->clk_freq != 100000 && dev->clk_freq != 400000
320323
&& dev->clk_freq != 1000000 && dev->clk_freq != 3400000) {
321324
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);
323327
ret = -EINVAL;
324328
goto exit_reset;
325329
}

drivers/i2c/i2c-core-acpi.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap)
230230
dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
231231
}
232232

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+
233243
static acpi_status i2c_acpi_lookup_speed(acpi_handle handle, u32 level,
234244
void *data, void **return_value)
235245
{
@@ -289,7 +299,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev)
289299
}
290300
EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed);
291301

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)
293303
{
294304
struct i2c_adapter *adapter = i2c_verify_adapter(dev);
295305

@@ -299,7 +309,7 @@ static int i2c_acpi_match_adapter(struct device *dev, void *data)
299309
return ACPI_HANDLE(dev) == (acpi_handle)data;
300310
}
301311

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)
303313
{
304314
return ACPI_COMPANION(dev) == data;
305315
}
@@ -309,15 +319,16 @@ static struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle handle)
309319
struct device *dev;
310320

311321
dev = bus_find_device(&i2c_bus_type, NULL, handle,
312-
i2c_acpi_match_adapter);
322+
i2c_acpi_find_match_adapter);
313323
return dev ? i2c_verify_adapter(dev) : NULL;
314324
}
315325

316326
static struct i2c_client *i2c_acpi_find_client_by_adev(struct acpi_device *adev)
317327
{
318328
struct device *dev;
319329

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);
321332
return dev ? i2c_verify_client(dev) : NULL;
322333
}
323334

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ static int i2c_device_probe(struct device *dev)
357357
* Tree match table entry is supplied for the probing device.
358358
*/
359359
if (!driver->id_table &&
360+
!i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
360361
!i2c_of_match_device(dev->driver->of_match_table, client))
361362
return -ENODEV;
362363

drivers/i2c/i2c-core.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ int i2c_check_addr_validity(unsigned addr, unsigned short flags);
3131
int i2c_check_7bit_addr_validity_strict(unsigned short addr);
3232

3333
#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);
3437
void i2c_acpi_register_devices(struct i2c_adapter *adap);
3538
#else /* CONFIG_ACPI */
3639
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+
}
3746
#endif /* CONFIG_ACPI */
3847
extern struct notifier_block i2c_acpi_notifier;
3948

drivers/i2c/muxes/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ config I2C_MUX_PINCTRL
8383
different sets of pins at run-time.
8484

8585
This driver can also be built as a module. If so, the module will be
86-
called pinctrl-i2cmux.
86+
called i2c-mux-pinctrl.
8787

8888
config I2C_MUX_REG
8989
tristate "Register-based I2C multiplexer"

include/linux/i2c.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,8 @@ i2c_unlock_adapter(struct i2c_adapter *adapter)
689689
#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
690690
#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
691691
#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)
693694

694695
/* Internal numbers to terminate lists */
695696
#define I2C_CLIENT_END 0xfffeU

0 commit comments

Comments
 (0)