Merge branch 'i2c-mux/for-next' of https://github.com/peda-r/i2c-mux into i2c/for-4.18
This time around we have mostly trivial changes. However, there are also a couple of "real" patches improving a few aspects of the demux-pinctrl behavior and we also actually reset pca954x chips on probe when we have the ability to do so.
This commit is contained in:
commit
03828ceee6
|
@ -418,7 +418,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
|
|||
snprintf(symlink_name, sizeof(symlink_name), "channel-%u", chan_id);
|
||||
WARN(sysfs_create_link(&muxc->dev->kobj, &priv->adap.dev.kobj,
|
||||
symlink_name),
|
||||
"can't create symlink for channel %u\n", chan_id);
|
||||
"can't create symlink to channel %u\n", chan_id);
|
||||
dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
|
||||
i2c_adapter_id(&priv->adap));
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sysfs.h>
|
||||
|
||||
|
@ -105,7 +106,7 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne
|
|||
priv->cur_adap.owner = THIS_MODULE;
|
||||
priv->cur_adap.algo = &priv->algo;
|
||||
priv->cur_adap.algo_data = priv;
|
||||
priv->cur_adap.dev.parent = priv->dev;
|
||||
priv->cur_adap.dev.parent = &adap->dev;
|
||||
priv->cur_adap.class = adap->class;
|
||||
priv->cur_adap.retries = adap->retries;
|
||||
priv->cur_adap.timeout = adap->timeout;
|
||||
|
@ -254,6 +255,8 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
pm_runtime_no_callbacks(&pdev->dev);
|
||||
|
||||
/* switch to first parent as active master */
|
||||
i2c_demux_activate_master(priv, 0);
|
||||
|
||||
|
|
|
@ -206,8 +206,7 @@ static const struct of_device_id ltc4306_of_match[] = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(of, ltc4306_of_match);
|
||||
|
||||
static int ltc4306_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
static int ltc4306_probe(struct i2c_client *client)
|
||||
{
|
||||
struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
|
||||
const struct chip_desc *chip;
|
||||
|
@ -221,7 +220,7 @@ static int ltc4306_probe(struct i2c_client *client,
|
|||
chip = of_device_get_match_data(&client->dev);
|
||||
|
||||
if (!chip)
|
||||
chip = &chips[id->driver_data];
|
||||
chip = &chips[i2c_match_id(ltc4306_id, client)->driver_data];
|
||||
|
||||
idle_disc = device_property_read_bool(&client->dev,
|
||||
"i2c-mux-idle-disconnect");
|
||||
|
@ -310,7 +309,7 @@ static struct i2c_driver ltc4306_driver = {
|
|||
.name = "ltc4306",
|
||||
.of_match_table = of_match_ptr(ltc4306_of_match),
|
||||
},
|
||||
.probe = ltc4306_probe,
|
||||
.probe_new = ltc4306_probe,
|
||||
.remove = ltc4306_remove,
|
||||
.id_table = ltc4306_id,
|
||||
};
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-mux.h>
|
||||
|
@ -373,7 +374,6 @@ static int pca954x_probe(struct i2c_client *client,
|
|||
int num, force, class;
|
||||
struct i2c_mux_core *muxc;
|
||||
struct pca954x *data;
|
||||
const struct of_device_id *match;
|
||||
int ret;
|
||||
|
||||
if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
|
||||
|
@ -389,15 +389,19 @@ static int pca954x_probe(struct i2c_client *client,
|
|||
i2c_set_clientdata(client, muxc);
|
||||
data->client = client;
|
||||
|
||||
/* Get the mux out of reset if a reset GPIO is specified. */
|
||||
gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
|
||||
/* Reset the mux if a reset GPIO is specified. */
|
||||
gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(gpio))
|
||||
return PTR_ERR(gpio);
|
||||
if (gpio) {
|
||||
udelay(1);
|
||||
gpiod_set_value_cansleep(gpio, 0);
|
||||
/* Give the chip some time to recover. */
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev);
|
||||
if (match)
|
||||
data->chip = of_device_get_match_data(&client->dev);
|
||||
else
|
||||
data->chip = of_device_get_match_data(&client->dev);
|
||||
if (!data->chip)
|
||||
data->chip = &chips[id->driver_data];
|
||||
|
||||
if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) {
|
||||
|
|
|
@ -127,10 +127,8 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux,
|
|||
values = devm_kzalloc(&pdev->dev,
|
||||
sizeof(*mux->data.values) * mux->data.n_values,
|
||||
GFP_KERNEL);
|
||||
if (!values) {
|
||||
dev_err(&pdev->dev, "Cannot allocate values array");
|
||||
if (!values)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
for_each_child_of_node(np, child) {
|
||||
of_property_read_u32(child, "reg", values + i);
|
||||
|
|
Loading…
Reference in New Issue