All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI
@ 2016-06-06 11:26 Jarkko Nikula
  2016-06-06 11:26 ` [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace Jarkko Nikula
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jarkko Nikula @ 2016-06-06 11:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Andy Shevchenko, Mika Westerberg, Weifeng Voon,
	Jarkko Nikula

These patches add support to i2c-core for finding the bus speed from
ACPI by looking at slowest connection from ACPI I2cSerialBus resources
that are associated to I2C controller and use it in i2c-designware.

i2c-core patches apply on top of v4.7-rc1 and i2c-designware change is
on top of Weifeng's fast mode + and high speed set:

http://www.spinics.net/lists/linux-i2c/msg24699.html

Jarkko Nikula (3):
  i2c: core: Cleanup I2C ACPI namespace
  i2c: core: Add function for finding the bus speed from ACPI
  i2c: designware: Find bus speed from ACPI

 drivers/i2c/busses/i2c-designware-platdrv.c |   6 +-
 drivers/i2c/i2c-core.c                      | 116 +++++++++++++++++++---------
 include/linux/i2c.h                         |   9 +++
 3 files changed, 94 insertions(+), 37 deletions(-)

-- 
2.8.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace
  2016-06-06 11:26 [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI Jarkko Nikula
@ 2016-06-06 11:26 ` Jarkko Nikula
  2016-07-14 13:35   ` Wolfram Sang
  2016-06-06 11:26 ` [PATCH 2/3] i2c: core: Add function for finding the bus speed from ACPI Jarkko Nikula
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2016-06-06 11:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Andy Shevchenko, Mika Westerberg, Weifeng Voon,
	Jarkko Nikula

I2C ACPI enumeration was originally implemented in another module under
drivers/acpi/ but was later moved into i2c-core with added support for
I2C ACPI operation region.

Rename these acpi_i2c_ prefixed functions, structures and defines in
i2c-core to i2c_acpi_ in order to have more consistent name space.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/i2c-core.c | 54 +++++++++++++++++++++++++-------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index af11b658984d..f6a85fa3f10a 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -86,7 +86,7 @@ void i2c_transfer_trace_unreg(void)
 }
 
 #if defined(CONFIG_ACPI)
-struct acpi_i2c_handler_data {
+struct i2c_acpi_handler_data {
 	struct acpi_connection_info info;
 	struct i2c_adapter *adapter;
 };
@@ -101,15 +101,15 @@ struct gsb_buffer {
 	};
 } __packed;
 
-struct acpi_i2c_lookup {
+struct i2c_acpi_lookup {
 	struct i2c_board_info *info;
 	acpi_handle adapter_handle;
 	acpi_handle device_handle;
 };
 
-static int acpi_i2c_find_address(struct acpi_resource *ares, void *data)
+static int i2c_acpi_find_address(struct acpi_resource *ares, void *data)
 {
-	struct acpi_i2c_lookup *lookup = data;
+	struct i2c_acpi_lookup *lookup = data;
 	struct i2c_board_info *info = lookup->info;
 	struct acpi_resource_i2c_serialbus *sb;
 	acpi_handle adapter_handle;
@@ -138,12 +138,12 @@ static int acpi_i2c_find_address(struct acpi_resource *ares, void *data)
 	return 1;
 }
 
-static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
+static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
 				       void *data, void **return_value)
 {
 	struct i2c_adapter *adapter = data;
 	struct list_head resource_list;
-	struct acpi_i2c_lookup lookup;
+	struct i2c_acpi_lookup lookup;
 	struct resource_entry *entry;
 	struct i2c_board_info info;
 	struct acpi_device *adev;
@@ -168,7 +168,7 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
 	 */
 	INIT_LIST_HEAD(&resource_list);
 	ret = acpi_dev_get_resources(adev, &resource_list,
-				     acpi_i2c_find_address, &lookup);
+				     i2c_acpi_find_address, &lookup);
 	acpi_dev_free_resource_list(&resource_list);
 
 	if (ret < 0 || !info.addr)
@@ -200,17 +200,17 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
 	return AE_OK;
 }
 
-#define ACPI_I2C_MAX_SCAN_DEPTH 32
+#define I2C_ACPI_MAX_SCAN_DEPTH 32
 
 /**
- * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter
+ * i2c_acpi_register_devices - enumerate I2C slave devices behind adapter
  * @adap: pointer to adapter
  *
  * Enumerate all I2C slave devices behind this adapter by walking the ACPI
  * namespace. When a device is found it will be added to the Linux device
  * model and bound to the corresponding ACPI handle.
  */
-static void acpi_i2c_register_devices(struct i2c_adapter *adap)
+static void i2c_acpi_register_devices(struct i2c_adapter *adap)
 {
 	acpi_status status;
 
@@ -218,15 +218,15 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap)
 		return;
 
 	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-				     ACPI_I2C_MAX_SCAN_DEPTH,
-				     acpi_i2c_add_device, NULL,
+				     I2C_ACPI_MAX_SCAN_DEPTH,
+				     i2c_acpi_add_device, NULL,
 				     adap, NULL);
 	if (ACPI_FAILURE(status))
 		dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
 }
 
 #else /* CONFIG_ACPI */
-static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { }
+static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { }
 #endif /* CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI_I2C_OPREGION
@@ -291,12 +291,12 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
 }
 
 static acpi_status
-acpi_i2c_space_handler(u32 function, acpi_physical_address command,
+i2c_acpi_space_handler(u32 function, acpi_physical_address command,
 			u32 bits, u64 *value64,
 			void *handler_context, void *region_context)
 {
 	struct gsb_buffer *gsb = (struct gsb_buffer *)value64;
-	struct acpi_i2c_handler_data *data = handler_context;
+	struct i2c_acpi_handler_data *data = handler_context;
 	struct acpi_connection_info *info = &data->info;
 	struct acpi_resource_i2c_serialbus *sb;
 	struct i2c_adapter *adapter = data->adapter;
@@ -414,10 +414,10 @@ acpi_i2c_space_handler(u32 function, acpi_physical_address command,
 }
 
 
-static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
+static int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)
 {
 	acpi_handle handle;
-	struct acpi_i2c_handler_data *data;
+	struct i2c_acpi_handler_data *data;
 	acpi_status status;
 
 	if (!adapter->dev.parent)
@@ -428,7 +428,7 @@ static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
 	if (!handle)
 		return -ENODEV;
 
-	data = kzalloc(sizeof(struct acpi_i2c_handler_data),
+	data = kzalloc(sizeof(struct i2c_acpi_handler_data),
 			    GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
@@ -442,7 +442,7 @@ static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
 
 	status = acpi_install_address_space_handler(handle,
 				ACPI_ADR_SPACE_GSBUS,
-				&acpi_i2c_space_handler,
+				&i2c_acpi_space_handler,
 				NULL,
 				data);
 	if (ACPI_FAILURE(status)) {
@@ -456,10 +456,10 @@ static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
 	return 0;
 }
 
-static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
+static void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter)
 {
 	acpi_handle handle;
-	struct acpi_i2c_handler_data *data;
+	struct i2c_acpi_handler_data *data;
 	acpi_status status;
 
 	if (!adapter->dev.parent)
@@ -472,7 +472,7 @@ static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
 
 	acpi_remove_address_space_handler(handle,
 				ACPI_ADR_SPACE_GSBUS,
-				&acpi_i2c_space_handler);
+				&i2c_acpi_space_handler);
 
 	status = acpi_bus_get_private_data(handle, (void **)&data);
 	if (ACPI_SUCCESS(status))
@@ -481,10 +481,10 @@ static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
 	acpi_bus_detach_private_data(handle);
 }
 #else /* CONFIG_ACPI_I2C_OPREGION */
-static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
+static inline void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter)
 { }
 
-static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
+static inline int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)
 { return 0; }
 #endif /* CONFIG_ACPI_I2C_OPREGION */
 
@@ -1606,8 +1606,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 exit_recovery:
 	/* create pre-declared device nodes */
 	of_i2c_register_devices(adap);
-	acpi_i2c_register_devices(adap);
-	acpi_i2c_install_space_handler(adap);
+	i2c_acpi_register_devices(adap);
+	i2c_acpi_install_space_handler(adap);
 
 	if (adap->nr < __i2c_first_dynamic_bus_num)
 		i2c_scan_static_board_info(adap);
@@ -1781,7 +1781,7 @@ void i2c_del_adapter(struct i2c_adapter *adap)
 		return;
 	}
 
-	acpi_i2c_remove_space_handler(adap);
+	i2c_acpi_remove_space_handler(adap);
 	/* Tell drivers about this removal */
 	mutex_lock(&core_lock);
 	bus_for_each_drv(&i2c_bus_type, NULL, adap,
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/3] i2c: core: Add function for finding the bus speed from ACPI
  2016-06-06 11:26 [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI Jarkko Nikula
  2016-06-06 11:26 ` [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace Jarkko Nikula
@ 2016-06-06 11:26 ` Jarkko Nikula
  2016-07-14 13:35   ` Wolfram Sang
  2016-06-06 11:26 ` [PATCH 3/3] i2c: designware: Find " Jarkko Nikula
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2016-06-06 11:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Andy Shevchenko, Mika Westerberg, Weifeng Voon,
	Jarkko Nikula

ACPI 5 specification doesn't have property for the I2C bus speed but
I2cSerialBus resource descriptors which define each controller-slave
connection define the maximum speed supported by that connection.

Thus finding the maximum safe speed for the bus is to walk all
I2cSerialBus resources that are associated to I2C controller and use
the speed of slowest connection.

Add function i2c_acpi_find_bus_speed() to the i2c-core that adapter
drivers can call prior registering itself to core.

This implies two-step walk through the I2cSerialBus resources: call to
i2c_acpi_find_bus_speed() does the first scan and finds the safe bus
speed that adapter drivers can set up. Adapter driver registration does
the second scan when i2c-core creates the I2C slaves by calling the
i2c_acpi_register_devices(). In that way the bus speed is set in case
slave device probe gets called during registration and does
communication.

Implement this by reusing the existing ACPI I2C walk routines in the
i2c-core. Extend them so that slowest connection speed is saved during
the walk and I2C slaves are registered only when calling through the
i2c_acpi_register_devices() with the i2c_adapter pointer.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/i2c-core.c | 74 ++++++++++++++++++++++++++++++++++++++++----------
 include/linux/i2c.h    |  9 ++++++
 2 files changed, 68 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index f6a85fa3f10a..99ae7dcf7768 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -103,11 +103,13 @@ struct gsb_buffer {
 
 struct i2c_acpi_lookup {
 	struct i2c_board_info *info;
+	struct i2c_adapter *adapter; /* set only when registering slaves */
 	acpi_handle adapter_handle;
 	acpi_handle device_handle;
+	u32 min_speed;
 };
 
-static int i2c_acpi_find_address(struct acpi_resource *ares, void *data)
+static int i2c_acpi_find_resource(struct acpi_resource *ares, void *data)
 {
 	struct i2c_acpi_lookup *lookup = data;
 	struct i2c_board_info *info = lookup->info;
@@ -133,17 +135,20 @@ static int i2c_acpi_find_address(struct acpi_resource *ares, void *data)
 		info->addr = sb->slave_address;
 		if (sb->access_mode == ACPI_I2C_10BIT_MODE)
 			info->flags |= I2C_CLIENT_TEN;
+		/* Save speed of the slowest device */
+		if (sb->connection_speed < lookup->min_speed)
+			lookup->min_speed = sb->connection_speed;
 	}
 
 	return 1;
 }
 
-static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
-				       void *data, void **return_value)
+static acpi_status i2c_acpi_slave_lookup(acpi_handle handle, u32 level,
+					 void *data, void **return_value)
 {
-	struct i2c_adapter *adapter = data;
+	struct i2c_acpi_lookup *lookup = data;
+	struct i2c_adapter *adapter = lookup->adapter;
 	struct list_head resource_list;
-	struct i2c_acpi_lookup lookup;
 	struct resource_entry *entry;
 	struct i2c_board_info info;
 	struct acpi_device *adev;
@@ -157,10 +162,8 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
 	memset(&info, 0, sizeof(info));
 	info.fwnode = acpi_fwnode_handle(adev);
 
-	memset(&lookup, 0, sizeof(lookup));
-	lookup.adapter_handle = ACPI_HANDLE(&adapter->dev);
-	lookup.device_handle = handle;
-	lookup.info = &info;
+	lookup->device_handle = handle;
+	lookup->info = &info;
 
 	/*
 	 * Look up for I2cSerialBus resource with ResourceSource that
@@ -168,10 +171,10 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
 	 */
 	INIT_LIST_HEAD(&resource_list);
 	ret = acpi_dev_get_resources(adev, &resource_list,
-				     i2c_acpi_find_address, &lookup);
+				     i2c_acpi_find_resource, lookup);
 	acpi_dev_free_resource_list(&resource_list);
 
-	if (ret < 0 || !info.addr)
+	if (ret < 0 || !info.addr || !lookup->adapter)
 		return AE_OK;
 
 	/* Then fill IRQ number if any */
@@ -202,6 +205,14 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
 
 #define I2C_ACPI_MAX_SCAN_DEPTH 32
 
+static acpi_status i2c_acpi_walk(struct i2c_acpi_lookup *lookup)
+{
+	return acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+				   I2C_ACPI_MAX_SCAN_DEPTH,
+				   i2c_acpi_slave_lookup, NULL,
+				   lookup, NULL);
+}
+
 /**
  * i2c_acpi_register_devices - enumerate I2C slave devices behind adapter
  * @adap: pointer to adapter
@@ -212,19 +223,52 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
  */
 static void i2c_acpi_register_devices(struct i2c_adapter *adap)
 {
+	struct i2c_acpi_lookup lookup;
 	acpi_status status;
 
 	if (!has_acpi_companion(&adap->dev))
 		return;
 
-	status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-				     I2C_ACPI_MAX_SCAN_DEPTH,
-				     i2c_acpi_add_device, NULL,
-				     adap, NULL);
+	memset(&lookup, 0, sizeof(lookup));
+	lookup.adapter = adap;
+	lookup.adapter_handle = ACPI_HANDLE(&adap->dev);
+
+	status = i2c_acpi_walk(&lookup);
 	if (ACPI_FAILURE(status))
 		dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
 }
 
+/**
+ * i2c_acpi_find_bus_speed - find I2C bus speed from ACPI
+ * @dev: The device owning the bus
+ *
+ * Find the I2C bus speed by walking the ACPI namespace for all I2C slaves
+ * devices connected to this bus and use the speed of slowest device.
+ *
+ * Returns the speed in Hz or zero
+ */
+u32 i2c_acpi_find_bus_speed(struct device *dev)
+{
+	struct i2c_acpi_lookup lookup;
+	acpi_status status;
+
+	if (!has_acpi_companion(dev))
+		return 0;
+
+	memset(&lookup, 0, sizeof(lookup));
+	lookup.adapter_handle = ACPI_HANDLE(dev);
+	lookup.min_speed = UINT_MAX;
+
+	status = i2c_acpi_walk(&lookup);
+	if (ACPI_FAILURE(status)) {
+		dev_warn(dev, "unable to find I2C bus speed from ACPI\n");
+		return 0;
+	}
+
+	return lookup.min_speed != UINT_MAX ? lookup.min_speed : 0;
+}
+EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed);
+
 #else /* CONFIG_ACPI */
 static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { }
 #endif /* CONFIG_ACPI */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 96a25ae14494..9959ba26bc37 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -753,4 +753,13 @@ static inline struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node
 }
 #endif /* CONFIG_OF */
 
+#if IS_ENABLED(CONFIG_ACPI)
+u32 i2c_acpi_find_bus_speed(struct device *dev);
+#else
+static inline u32 i2c_acpi_find_bus_speed(struct device *dev)
+{
+	return 0;
+}
+#endif /* CONFIG_ACPI */
+
 #endif /* _LINUX_I2C_H */
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/3] i2c: designware: Find bus speed from ACPI
  2016-06-06 11:26 [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI Jarkko Nikula
  2016-06-06 11:26 ` [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace Jarkko Nikula
  2016-06-06 11:26 ` [PATCH 2/3] i2c: core: Add function for finding the bus speed from ACPI Jarkko Nikula
@ 2016-06-06 11:26 ` Jarkko Nikula
  2016-07-14 13:36   ` Wolfram Sang
  2016-06-06 13:24 ` [PATCH 0/3] i2c: core/designware: " Andy Shevchenko
  2016-06-06 16:06 ` Mika Westerberg
  4 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2016-06-06 11:26 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Andy Shevchenko, Mika Westerberg, Weifeng Voon,
	Jarkko Nikula

Fast mode is the default speed of i2c-designware which can be overridden
by platform data or by "clock-frequency" device property. Even though
the ACPI 5.1 can pass device properties via _DSD method, shipping systems
define the connection speed between I2C host and each slave in their
I2cSerialBus resources. Which means speed is not defined per bus but per
slave.

As there is now support in i2c-core to find the bus speed from ACPI use
that to set up the bus speed prior registering the I2C adapter.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index cb846cb50512..0b42a12171f3 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -157,7 +157,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	struct i2c_adapter *adap;
 	struct resource *mem;
 	int irq, r;
-	u32 ht = 0;
+	u32 acpi_speed, ht = 0;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
@@ -192,6 +192,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 					 &dev->clk_freq);
 	}
 
+	acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
+	if (acpi_speed)
+		dev->clk_freq = acpi_speed;
+
 	if (has_acpi_companion(&pdev->dev))
 		dw_i2c_acpi_configure(pdev);
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI
  2016-06-06 11:26 [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI Jarkko Nikula
                   ` (2 preceding siblings ...)
  2016-06-06 11:26 ` [PATCH 3/3] i2c: designware: Find " Jarkko Nikula
@ 2016-06-06 13:24 ` Andy Shevchenko
  2016-06-06 16:06 ` Mika Westerberg
  4 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2016-06-06 13:24 UTC (permalink / raw)
  To: Jarkko Nikula, linux-i2c; +Cc: Wolfram Sang, Mika Westerberg, Weifeng Voon

On Mon, 2016-06-06 at 14:26 +0300, Jarkko Nikula wrote:
> These patches add support to i2c-core for finding the bus speed from
> ACPI by looking at slowest connection from ACPI I2cSerialBus resources
> that are associated to I2C controller and use it in i2c-designware.
> 
> i2c-core patches apply on top of v4.7-rc1 and i2c-designware change is
> on top of Weifeng's fast mode + and high speed set:
> 
> http://www.spinics.net/lists/linux-i2c/msg24699.html

Looks good to me:

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> Jarkko Nikula (3):
>   i2c: core: Cleanup I2C ACPI namespace
>   i2c: core: Add function for finding the bus speed from ACPI
>   i2c: designware: Find bus speed from ACPI
> 
>  drivers/i2c/busses/i2c-designware-platdrv.c |   6 +-
>  drivers/i2c/i2c-core.c                      | 116
> +++++++++++++++++++---------
>  include/linux/i2c.h                         |   9 +++
>  3 files changed, 94 insertions(+), 37 deletions(-)
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI
  2016-06-06 11:26 [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI Jarkko Nikula
                   ` (3 preceding siblings ...)
  2016-06-06 13:24 ` [PATCH 0/3] i2c: core/designware: " Andy Shevchenko
@ 2016-06-06 16:06 ` Mika Westerberg
  4 siblings, 0 replies; 13+ messages in thread
From: Mika Westerberg @ 2016-06-06 16:06 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Wolfram Sang, Andy Shevchenko, Weifeng Voon

On Mon, Jun 06, 2016 at 02:26:20PM +0300, Jarkko Nikula wrote:
> These patches add support to i2c-core for finding the bus speed from
> ACPI by looking at slowest connection from ACPI I2cSerialBus resources
> that are associated to I2C controller and use it in i2c-designware.
> 
> i2c-core patches apply on top of v4.7-rc1 and i2c-designware change is
> on top of Weifeng's fast mode + and high speed set:
> 
> http://www.spinics.net/lists/linux-i2c/msg24699.html
> 
> Jarkko Nikula (3):
>   i2c: core: Cleanup I2C ACPI namespace
>   i2c: core: Add function for finding the bus speed from ACPI
>   i2c: designware: Find bus speed from ACPI

For the whole series,

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace
  2016-06-06 11:26 ` [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace Jarkko Nikula
@ 2016-07-14 13:35   ` Wolfram Sang
  2016-07-19  4:33     ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2016-07-14 13:35 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Andy Shevchenko, Mika Westerberg, Weifeng Voon

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

On Mon, Jun 06, 2016 at 02:26:21PM +0300, Jarkko Nikula wrote:
> I2C ACPI enumeration was originally implemented in another module under
> drivers/acpi/ but was later moved into i2c-core with added support for
> I2C ACPI operation region.
> 
> Rename these acpi_i2c_ prefixed functions, structures and defines in
> i2c-core to i2c_acpi_ in order to have more consistent name space.
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] i2c: core: Add function for finding the bus speed from ACPI
  2016-06-06 11:26 ` [PATCH 2/3] i2c: core: Add function for finding the bus speed from ACPI Jarkko Nikula
@ 2016-07-14 13:35   ` Wolfram Sang
  2016-07-19  4:33     ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2016-07-14 13:35 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Andy Shevchenko, Mika Westerberg, Weifeng Voon

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

On Mon, Jun 06, 2016 at 02:26:22PM +0300, Jarkko Nikula wrote:
> ACPI 5 specification doesn't have property for the I2C bus speed but
> I2cSerialBus resource descriptors which define each controller-slave
> connection define the maximum speed supported by that connection.
> 
> Thus finding the maximum safe speed for the bus is to walk all
> I2cSerialBus resources that are associated to I2C controller and use
> the speed of slowest connection.
> 
> Add function i2c_acpi_find_bus_speed() to the i2c-core that adapter
> drivers can call prior registering itself to core.
> 
> This implies two-step walk through the I2cSerialBus resources: call to
> i2c_acpi_find_bus_speed() does the first scan and finds the safe bus
> speed that adapter drivers can set up. Adapter driver registration does
> the second scan when i2c-core creates the I2C slaves by calling the
> i2c_acpi_register_devices(). In that way the bus speed is set in case
> slave device probe gets called during registration and does
> communication.
> 
> Implement this by reusing the existing ACPI I2C walk routines in the
> i2c-core. Extend them so that slowest connection speed is saved during
> the walk and I2C slaves are registered only when calling through the
> i2c_acpi_register_devices() with the i2c_adapter pointer.
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] i2c: designware: Find bus speed from ACPI
  2016-06-06 11:26 ` [PATCH 3/3] i2c: designware: Find " Jarkko Nikula
@ 2016-07-14 13:36   ` Wolfram Sang
  2016-08-02 14:03     ` Jarkko Nikula
  0 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2016-07-14 13:36 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Andy Shevchenko, Mika Westerberg, Weifeng Voon

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

On Mon, Jun 06, 2016 at 02:26:23PM +0300, Jarkko Nikula wrote:
> Fast mode is the default speed of i2c-designware which can be overridden
> by platform data or by "clock-frequency" device property. Even though
> the ACPI 5.1 can pass device properties via _DSD method, shipping systems
> define the connection speed between I2C host and each slave in their
> I2cSerialBus resources. Which means speed is not defined per bus but per
> slave.
> 
> As there is now support in i2c-core to find the bus speed from ACPI use
> that to set up the bus speed prior registering the I2C adapter.
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

I can't apply this one? Neither on v4.6, v4.7-rc1 or on i2c/for-next?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace
  2016-07-14 13:35   ` Wolfram Sang
@ 2016-07-19  4:33     ` Wolfram Sang
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-07-19  4:33 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Andy Shevchenko, Mika Westerberg, Weifeng Voon

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

On Thu, Jul 14, 2016 at 10:35:25PM +0900, Wolfram Sang wrote:
> On Mon, Jun 06, 2016 at 02:26:21PM +0300, Jarkko Nikula wrote:
> > I2C ACPI enumeration was originally implemented in another module under
> > drivers/acpi/ but was later moved into i2c-core with added support for
> > I2C ACPI operation region.
> > 
> > Rename these acpi_i2c_ prefixed functions, structures and defines in
> > i2c-core to i2c_acpi_ in order to have more consistent name space.
> > 
> > Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> 
> Applied to for-next, thanks!

And reverted due to merge problems and 3/3 not being in shape currently.
Please rebase on v4.8-rc1 and resubmit.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] i2c: core: Add function for finding the bus speed from ACPI
  2016-07-14 13:35   ` Wolfram Sang
@ 2016-07-19  4:33     ` Wolfram Sang
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-07-19  4:33 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Andy Shevchenko, Mika Westerberg, Weifeng Voon

[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]

On Thu, Jul 14, 2016 at 10:35:41PM +0900, Wolfram Sang wrote:
> On Mon, Jun 06, 2016 at 02:26:22PM +0300, Jarkko Nikula wrote:
> > ACPI 5 specification doesn't have property for the I2C bus speed but
> > I2cSerialBus resource descriptors which define each controller-slave
> > connection define the maximum speed supported by that connection.
> > 
> > Thus finding the maximum safe speed for the bus is to walk all
> > I2cSerialBus resources that are associated to I2C controller and use
> > the speed of slowest connection.
> > 
> > Add function i2c_acpi_find_bus_speed() to the i2c-core that adapter
> > drivers can call prior registering itself to core.
> > 
> > This implies two-step walk through the I2cSerialBus resources: call to
> > i2c_acpi_find_bus_speed() does the first scan and finds the safe bus
> > speed that adapter drivers can set up. Adapter driver registration does
> > the second scan when i2c-core creates the I2C slaves by calling the
> > i2c_acpi_register_devices(). In that way the bus speed is set in case
> > slave device probe gets called during registration and does
> > communication.
> > 
> > Implement this by reusing the existing ACPI I2C walk routines in the
> > i2c-core. Extend them so that slowest connection speed is saved during
> > the walk and I2C slaves are registered only when calling through the
> > i2c_acpi_register_devices() with the i2c_adapter pointer.
> > 
> > Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> 
> Applied to for-next, thanks!

And reverted due to merge problems and 3/3 not being in shape currently.
Please rebase on v4.8-rc1 and resubmit.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] i2c: designware: Find bus speed from ACPI
  2016-07-14 13:36   ` Wolfram Sang
@ 2016-08-02 14:03     ` Jarkko Nikula
  2016-08-02 14:43       ` Wolfram Sang
  0 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2016-08-02 14:03 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Andy Shevchenko, Mika Westerberg, Weifeng Voon

Hi

On 07/14/2016 04:36 PM, Wolfram Sang wrote:
> On Mon, Jun 06, 2016 at 02:26:23PM +0300, Jarkko Nikula wrote:
>> Fast mode is the default speed of i2c-designware which can be overridden
>> by platform data or by "clock-frequency" device property. Even though
>> the ACPI 5.1 can pass device properties via _DSD method, shipping systems
>> define the connection speed between I2C host and each slave in their
>> I2cSerialBus resources. Which means speed is not defined per bus but per
>> slave.
>>
>> As there is now support in i2c-core to find the bus speed from ACPI use
>> that to set up the bus speed prior registering the I2C adapter.
>>
>> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
>
> I can't apply this one? Neither on v4.6, v4.7-rc1 or on i2c/for-next?
>
Sorry the delay, I was on vacation.

This one was dependent on Weifeng's fast mode + and high speed set while 
the patches 1-2/3 conflicted with Octavian's set I guess.

Weifeng's set appears to apply by resolving a single line. But since we 
both need to resend anyway maybe it's easier for you if we post our sets 
together after I resolve conflicts in my patches and do some testing?

-- 
Jarkko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] i2c: designware: Find bus speed from ACPI
  2016-08-02 14:03     ` Jarkko Nikula
@ 2016-08-02 14:43       ` Wolfram Sang
  0 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2016-08-02 14:43 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i2c, Andy Shevchenko, Mika Westerberg, Weifeng Voon

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]


> Weifeng's set appears to apply by resolving a single line. But since we both
> need to resend anyway maybe it's easier for you if we post our sets together
> after I resolve conflicts in my patches and do some testing?

That sounds indeed easier and is thus much appreciated.

And welcome back!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-08-02 15:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 11:26 [PATCH 0/3] i2c: core/designware: Find bus speed from ACPI Jarkko Nikula
2016-06-06 11:26 ` [PATCH 1/3] i2c: core: Cleanup I2C ACPI namespace Jarkko Nikula
2016-07-14 13:35   ` Wolfram Sang
2016-07-19  4:33     ` Wolfram Sang
2016-06-06 11:26 ` [PATCH 2/3] i2c: core: Add function for finding the bus speed from ACPI Jarkko Nikula
2016-07-14 13:35   ` Wolfram Sang
2016-07-19  4:33     ` Wolfram Sang
2016-06-06 11:26 ` [PATCH 3/3] i2c: designware: Find " Jarkko Nikula
2016-07-14 13:36   ` Wolfram Sang
2016-08-02 14:03     ` Jarkko Nikula
2016-08-02 14:43       ` Wolfram Sang
2016-06-06 13:24 ` [PATCH 0/3] i2c: core/designware: " Andy Shevchenko
2016-06-06 16:06 ` Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.