Messages in this thread | | | Date | Wed, 6 Jan 2016 15:20:46 +0100 | Subject | Re: [RFC v2 3/4] i2c: mux: demux-pinctrl: add driver | From | Geert Uytterhoeven <> |
| |
Hi Wolfram,
On Wed, Jan 6, 2016 at 2:51 PM, Wolfram Sang <wsa@the-dreams.de> wrote: > From: Wolfram Sang <wsa+renesas@sang-engineering.com> > > This driver allows an I2C bus to switch between multiple masters. This > is not hot-swichting because connected I2C slaves will be
switching
> re-instantiated. It is meant to select the best I2C core at runtime once > the task is known. Example: Prefer i2c-gpio over another I2C core > because of HW errata affetcing your use case.
affecting
> --- /dev/null > +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c > @@ -0,0 +1,276 @@ > +/* > + * Pinctrl based I2C DeMultiplexer > + * > + * Copyright (C) 2015-16 by Wolfram Sang, Sang Engineering <wsa@sang-engineering.com> > + * Copyright (C) 2015-16 by Renesas Electronics Corporation > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms of the GNU General Public License as published by the > + * Free Software Foundation; version 2 of the License. > + * > + * See the bindings doc for DTS setup. > + */ > + > +#include <linux/i2c.h> > +#include <linux/init.h> > +#include <linux/module.h> > +#include <linux/mutex.h> > +#include <linux/of.h> > +#include <linux/pinctrl/consumer.h> > +#include <linux/platform_device.h> > +#include <linux/slab.h> > +#include <linux/sysfs.h> > + > +struct i2c_demux_pinctrl_chan { > + struct device_node *parent_np; > + struct i2c_adapter *parent_adap; > + struct of_changeset chgset; > +}; > + > +struct i2c_demux_pinctrl_priv { > + int cur_chan; > + int num_chan;
This is always positive, so you can make num_chan and a few loop counters unsigned.
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
| |