Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1279993

[PATCH v2 13/16] mfd: intel-lpss: Add support for passing device properties

From Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v2 13/16] mfd: intel-lpss: Add support for passing device properties
Date 2015-11-30 16:20 +0100
Message-ID <qAypd-5id-59@gated-at.bofh.it> (permalink)
References <qAypb-5id-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mika Westerberg <mika.westerberg@linux.intel.com>

If the boot firmware does not support ACPI we need a way to pass device
configuration information to the drivers. The unified device properties API
already supports passing platform data via properties so let's take
advantage of that and allow probe drivers to pass set of properties to the
host controller driver.

In order to do that we need to be able to modify the MFD cell corresponding
the host controller, so make the core driver to take copy of the cell
instead of using it directly. Then we can assign info->pset to the
resulting copy of a cell and let the MFD core to assign that to the
resulting device.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mfd/intel-lpss.c | 16 ++++++++++++----
 drivers/mfd/intel-lpss.h |  2 ++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c
index 6255513..1743788 100644
--- a/drivers/mfd/intel-lpss.c
+++ b/drivers/mfd/intel-lpss.c
@@ -24,6 +24,7 @@
 #include <linux/mfd/core.h>
 #include <linux/pm_qos.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/seq_file.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 
@@ -72,7 +73,7 @@ struct intel_lpss {
 	enum intel_lpss_dev_type type;
 	struct clk *clk;
 	struct clk_lookup *clock;
-	const struct mfd_cell *cell;
+	struct mfd_cell *cell;
 	struct device *dev;
 	void __iomem *priv;
 	int devid;
@@ -217,6 +218,7 @@ static void intel_lpss_ltr_hide(struct intel_lpss *lpss)
 
 static int intel_lpss_assign_devs(struct intel_lpss *lpss)
 {
+	const struct mfd_cell *cell;
 	unsigned int type;
 
 	type = lpss->caps & LPSS_PRIV_CAPS_TYPE_MASK;
@@ -224,18 +226,22 @@ static int intel_lpss_assign_devs(struct intel_lpss *lpss)
 
 	switch (type) {
 	case LPSS_DEV_I2C:
-		lpss->cell = &intel_lpss_i2c_cell;
+		cell = &intel_lpss_i2c_cell;
 		break;
 	case LPSS_DEV_UART:
-		lpss->cell = &intel_lpss_uart_cell;
+		cell = &intel_lpss_uart_cell;
 		break;
 	case LPSS_DEV_SPI:
-		lpss->cell = &intel_lpss_spi_cell;
+		cell = &intel_lpss_spi_cell;
 		break;
 	default:
 		return -ENODEV;
 	}
 
+	lpss->cell = devm_kmemdup(lpss->dev, cell, sizeof(*cell), GFP_KERNEL);
+	if (!lpss->cell)
+		return -ENOMEM;
+
 	lpss->type = type;
 
 	return 0;
@@ -401,6 +407,8 @@ int intel_lpss_probe(struct device *dev,
 	if (ret)
 		return ret;
 
+	lpss->cell->pset = info->pset;
+
 	intel_lpss_init_dev(lpss);
 
 	lpss->devid = ida_simple_get(&intel_lpss_devid_ida, 0, 0, GFP_KERNEL);
diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h
index 2c7f8d7..0dcea9e 100644
--- a/drivers/mfd/intel-lpss.h
+++ b/drivers/mfd/intel-lpss.h
@@ -16,12 +16,14 @@
 
 struct device;
 struct resource;
+struct property_set;
 
 struct intel_lpss_platform_info {
 	struct resource *mem;
 	int irq;
 	unsigned long clk_rate;
 	const char *clk_con_id;
+	struct property_set *pset;
 };
 
 int intel_lpss_probe(struct device *dev,
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 00/16] intel-lpss: support non-ACPI platforms Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 11/16] driver core: Do not overwrite secondary fwnode with NULL if it is set Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 03/16] device property: refactor built-in properties support Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 12/16] mfd: core: propagate device properties to sub devices drivers Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 01/16] device property: always check for fwnode type Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 16/16] i2c: designware: Convert to use unified device property API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
    Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Wolfram Sang <wsa@the-dreams.de> - 2015-11-30 21:00 +0100
      Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-01 10:10 +0100
      Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-01 11:40 +0100
        Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device property API "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-02 02:00 +0100
          Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-12-02 10:30 +0100
            Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Mika Westerberg <mika.westerberg@linux.intel.com> - 2015-12-02 10:40 +0100
              Re: [PATCH v2 16/16] i2c: designware: Convert to use unified device  property API Wolfram Sang <wsa@the-dreams.de> - 2015-12-02 11:00 +0100
  [PATCH v2 14/16] mfd: intel-lpss: Pass SDA hold time to I2C host controller driver Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 15/16] mfd: intel-lpss: Pass HSUART configuration via properties Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  [PATCH v2 13/16] mfd: intel-lpss: Add support for passing device properties Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2015-11-30 16:20 +0100
  Re: [PATCH v2 00/16] intel-lpss: support non-ACPI platforms "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-07 02:20 +0100

csiph-web