Skip to content

Commit

Permalink
mfd: intel-lpss: Add support for passing device properties
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Mika Westerberg authored and Rafael J. Wysocki committed Dec 7, 2015
1 parent 4d215ca commit e15ad21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/mfd/intel-lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -217,25 +218,30 @@ 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;
type >>= LPSS_PRIV_CAPS_TYPE_SHIFT;

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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions drivers/mfd/intel-lpss.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e15ad21

Please sign in to comment.