Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752598AbaA3AId (ORCPT ); Wed, 29 Jan 2014 19:08:33 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:47819 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752547AbaA3AIb (ORCPT ); Wed, 29 Jan 2014 19:08:31 -0500 Date: Wed, 29 Jan 2014 16:08:30 -0800 (PST) Message-ID: <87mwieib5x.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto To: Mark Brown Cc: Liam Girdwood , Lee Jones , Simon , Magnus , Linux-SH , linux-kernel@vger.kernel.org Subject: Re: About gpio-regulator setting on DT In-Reply-To: <20140129124516.GZ11841@sirena.org.uk> References: <87r47r6v48.wl%kuninori.morimoto.gx@gmail.com> <20140129124516.GZ11841@sirena.org.uk> User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark > The combination of the enable-active-high and enable-at-boot properties > ought be able to cause the driver to do the right thing, the flags do > this: > > if (config->enabled_at_boot) { > if (config->enable_high) > cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; > else > cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW; > } else { > if (config->enable_high) > cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW; > else > cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; > } > > of_get_named_gpio() just looks up the GPIO number, it doesn't request > the GPIO. Hmm... I'm not sure detail, but, I need config->gpios[ptr].flags instead of cfg.ena_gpio_flags. Because it is used for drvdata->state. static int gpio_regulator_probe(struct platform_device *pdev) { if (np) { config = of_get_gpio_regulator_config(&pdev->dev, np); if (IS_ERR(config)) return PTR_ERR(config); } ... /* build initial state from gpio init data. */ state = 0; for (ptr = 0; ptr < drvdata->nr_gpios; ptr++) { if (config->gpios[ptr].flags & GPIOF_OUT_INIT_HIGH) <== we need this state |= (1 << ptr); } drvdata->state = state; ... cfg.ena_gpio_invert = !config->enable_high; if (config->enabled_at_boot) { if (config->enable_high) cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; else cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW; } else { if (config->enable_high) cfg.ena_gpio_flags |= GPIOF_OUT_INIT_LOW; else cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; } ) Best regards --- Kuninori Morimoto -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/