[alsa-devel] [PATCH V6 02/10] ASoC: SAMSUNG: Add DT support for i2s

Sylwester Nawrocki s.nawrocki at samsung.com
Thu Feb 14 11:48:59 CET 2013


On 01/18/2013 12:47 PM, Padmavathi Venna wrote:
> Add support for device based discovery.
> 
> Signed-off-by: Padmavathi Venna <padma.v at samsung.com>
> ---
...
>  /* Lock for cross i/f checks */
> @@ -997,19 +1006,76 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
>  	return i2s;
>  }
>  
> +#ifdef CONFIG_OF
> +static int samsung_i2s_parse_dt_gpio(struct i2s_dai *i2s)
> +{
> +	struct device *dev = &i2s->pdev->dev;
> +	int index, gpio, ret;
> +
> +	for (index = 0; index < 7; index++) {
> +		gpio = of_get_gpio(dev->of_node, index);
> +		if (!gpio_is_valid(gpio)) {
> +			dev_err(dev, "invalid gpio[%d]: %d\n", index, gpio);
> +			goto free_gpio;
> +		}
> +
> +		ret = gpio_request(gpio, dev_name(dev));
> +		if (ret) {
> +			dev_err(dev, "gpio [%d] request failed\n", gpio);
> +			goto free_gpio;
> +		}
> +		i2s->gpios[index] = gpio;
> +	}
> +	return 0;
> +
> +free_gpio:
> +	while (--index >= 0)
> +		gpio_free(i2s->gpios[index]);
> +	return -EINVAL;
> +}
> +
> +static void samsung_i2s_dt_gpio_free(struct i2s_dai *i2s)
> +{
> +	unsigned int index;
> +	for (index = 0; index < 7; index++)
> +		gpio_free(i2s->gpios[index]);
> +}
> +#else
> +static int samsung_i2s_parse_dt_gpio(struct i2s_dai *dai)
> +{
> +	return -EINVAL;
> +}
> +
> +static void samsung_i2s_dt_gpio_free(struct i2s_dai *dai)
> +{
> +}
> +
> +#endif

NAK.

Why we should leave with this temporary code when there is already
pinctrl support for Exynos SoCs ?

If the pinctrl driver for Exynos5 was updated you could instead just do

devm_pinctrl_get_select_default(&i2s->pdev->dev);


More information about the Alsa-devel mailing list