platform/x86: mlx-platform: Add physical bus number auto detection
mlx-platform does not provide a bus number to i2c-mlxcpld, assuming it is always one. On some x86 systems, other i2c drivers may probe before i2c-mlxcpld, causing bus one to be busy. Make mlx-platform determine which adapter number is free prior to activating i2c-mlxpld, adjusting the mux base numbers accordingly. Update the mlxreg-hotplug pdata similarly. This adds an explicit mlx-platform build dependency on I2C, update the Kconfig accordingly. Add the missing REGMAP dependency while we're at it. Signed-off-by: Vadim Pasternak <vadimp@mellanox.com> [dvhart: Rewrite commit message more concisely] [dvhart: Add build dependencies] Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
此提交包含在:
@@ -96,6 +96,8 @@ struct mlxreg_hotplug_priv_data {
|
||||
static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
|
||||
struct mlxreg_core_data *data)
|
||||
{
|
||||
struct mlxreg_core_hotplug_platform_data *pdata;
|
||||
|
||||
/*
|
||||
* Return if adapter number is negative. It could be in case hotplug
|
||||
* event is not associated with hotplug device.
|
||||
@@ -103,10 +105,12 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
|
||||
if (data->hpdev.nr < 0)
|
||||
return 0;
|
||||
|
||||
data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr);
|
||||
pdata = dev_get_platdata(&priv->pdev->dev);
|
||||
data->hpdev.adapter = i2c_get_adapter(data->hpdev.nr +
|
||||
pdata->shift_nr);
|
||||
if (!data->hpdev.adapter) {
|
||||
dev_err(priv->dev, "Failed to get adapter for bus %d\n",
|
||||
data->hpdev.nr);
|
||||
data->hpdev.nr + pdata->shift_nr);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
@@ -114,8 +118,8 @@ static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
|
||||
data->hpdev.brdinfo);
|
||||
if (!data->hpdev.client) {
|
||||
dev_err(priv->dev, "Failed to create client %s at bus %d at addr 0x%02x\n",
|
||||
data->hpdev.brdinfo->type, data->hpdev.nr,
|
||||
data->hpdev.brdinfo->addr);
|
||||
data->hpdev.brdinfo->type, data->hpdev.nr +
|
||||
pdata->shift_nr, data->hpdev.brdinfo->addr);
|
||||
|
||||
i2c_put_adapter(data->hpdev.adapter);
|
||||
data->hpdev.adapter = NULL;
|
||||
|
新增問題並參考
封鎖使用者