mirror of https://gitee.com/openkylin/linux.git
mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency
Avoids reimplementation of DMI matching in intel_quark_i2c_setup. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
9bf2db7834
commit
b518d4adb8
|
@ -58,19 +58,18 @@ struct intel_quark_mfd {
|
||||||
struct clk_lookup *i2c_clk_lookup;
|
struct clk_lookup *i2c_clk_lookup;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct i2c_mode_info {
|
static const struct dmi_system_id dmi_platform_info[] = {
|
||||||
const char *name;
|
|
||||||
unsigned int i2c_scl_freq;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct i2c_mode_info platform_i2c_mode_info[] = {
|
|
||||||
{
|
{
|
||||||
.name = "Galileo",
|
.matches = {
|
||||||
.i2c_scl_freq = 100000,
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "Galileo"),
|
||||||
|
},
|
||||||
|
.driver_data = (void *)100000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "GalileoGen2",
|
.matches = {
|
||||||
.i2c_scl_freq = 400000,
|
DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"),
|
||||||
|
},
|
||||||
|
.driver_data = (void *)400000,
|
||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
@ -160,8 +159,7 @@ static void intel_quark_unregister_i2c_clk(struct device *dev)
|
||||||
|
|
||||||
static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
|
static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
|
||||||
{
|
{
|
||||||
const char *board_name = dmi_get_system_info(DMI_BOARD_NAME);
|
const struct dmi_system_id *dmi_id;
|
||||||
const struct i2c_mode_info *info;
|
|
||||||
struct dw_i2c_platform_data *pdata;
|
struct dw_i2c_platform_data *pdata;
|
||||||
struct resource *res = (struct resource *)cell->resources;
|
struct resource *res = (struct resource *)cell->resources;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
|
@ -181,14 +179,9 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)
|
||||||
/* Normal mode by default */
|
/* Normal mode by default */
|
||||||
pdata->i2c_scl_freq = 100000;
|
pdata->i2c_scl_freq = 100000;
|
||||||
|
|
||||||
if (board_name) {
|
dmi_id = dmi_first_match(dmi_platform_info);
|
||||||
for (info = platform_i2c_mode_info; info->name; info++) {
|
if (dmi_id)
|
||||||
if (!strcmp(board_name, info->name)) {
|
pdata->i2c_scl_freq = (uintptr_t)dmi_id->driver_data;
|
||||||
pdata->i2c_scl_freq = info->i2c_scl_freq;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cell->platform_data = pdata;
|
cell->platform_data = pdata;
|
||||||
cell->pdata_size = sizeof(*pdata);
|
cell->pdata_size = sizeof(*pdata);
|
||||||
|
|
Loading…
Reference in New Issue