[PATCH v3 1/3] i2c: mux: Add i2c-arbitrator-cros-ec 'mux' driver

Stephen Warren swarren at wwwdotorg.org
Sat Feb 16 08:31:48 EST 2013


On 02/15/2013 12:46 PM, Doug Anderson wrote:
> The i2c-arbitrator-cros-ec driver implements the arbitration scheme
> that the Embedded Controller (EC) on the ARM Chromebook expects to use
> for bus multimastering.  This i2c-arbitrator-cros-ec driver could also
> be used in other places where standard I2C bus arbitration can't be
> used and two extra GPIOs are available for arbitration.
> 
> This driver is based on code that Simon Glass added to the i2c-s3c2410
> driver in the Chrome OS kernel 3.4 tree.  The current incarnation as a
> mux driver is as suggested by Grant Likely.  See
> <https://patchwork.kernel.org/patch/1877311/> for some history.

Reviewed-by: Stephen Warren <swarren at nvidia.com>

> diff --git a/drivers/i2c/muxes/i2c-arbitrator-cros-ec.c b/drivers/i2c/muxes/i2c-arbitrator-cros-ec.c

> +static int i2c_arbitrator_probe(struct platform_device *pdev)

> +	/* Request GPIOs */
> +	ret = of_get_named_gpio_flags(np, "ap-claim-gpio", 0, &gpio_flags);
> +	if (ret == -EPROBE_DEFER || WARN_ON(!gpio_is_valid(ret)))
> +		return ret;

I think by the time that doesn't return -EPROBE_DEFER ...

> +	arb->ap_gpio = ret;
> +	arb->ap_gpio_release = !!(gpio_flags & OF_GPIO_ACTIVE_LOW);
> +	out_init = (gpio_flags & OF_GPIO_ACTIVE_LOW) ?
> +		GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
> +	ret = devm_gpio_request_one(&pdev->dev, arb->ap_gpio, out_init,
> +				    "ap-claim-gpio");
> +	if (ret == -EPROBE_DEFER || WARN_ON(ret))
> +		return ret;

... that won't either, since of_get_named_gpio_flags()'s implementation
requires the relevant GPIO driver to be active already.

Still, there's no harm in the code as it stands, so no need to change.


More information about the devicetree-discuss mailing list