linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sdhci-tegra and power-gpios
@ 2012-10-01 15:15 Chris Ball
       [not found] ` <87vceunrzi.fsf-DGHOrqG7t0YzNDMTQreKSUB+6BGkLq7r@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Ball @ 2012-10-01 15:15 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA

Hi Stephen, tegra folks,

sdhci-tegra uses a power-gpios property in the DT:

        sdhci@c8000400 {
                status = "okay";
                cd-gpios = <&gpio 69 0>; /* gpio PI5 */
                wp-gpios = <&gpio 57 0>; /* gpio PH1 */
                power-gpios = <&gpio 70 0>; /* gpio PI6 */
                bus-width = <4>;
        };

which it turns on at probe-time in the driver:

        plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
        ...
	if (gpio_is_valid(plat->power_gpio)) {
		rc = gpio_request(plat->power_gpio, "sdhci_power");
		if (rc) {
			dev_err(mmc_dev(host->mmc),
				"failed to allocate power gpio\n");
			goto err_power_req;
		}
		gpio_direction_output(plat->power_gpio, 1);
	}

and then leaves on forever.  Seems like this should instead be a fixed
regulator (vmmc-supply) -- the MMC core would handle powering it up and
down as needed, and it's cleaner to let the regulator subsystem handle
power changes like this.  It might save you some power, too.

It's quite easy to set up a regulator and attach it to an MMC node:

        vmmc1: fixedregulator@0 {
                compatible = "regulator-fixed";
                regulator-name = "fixed-supply";
                regulator-min-microvolt = <2200000>;
                regulator-max-microvolt = <2200000>;
                gpio = <&gpio 70 0>; /* gpio PI6 */
                startup-delay-us = <70000>;
                vin-supply = <&parent_reg>;
        };
..
        sdhci@c8000400 {
                status = "okay";
                cd-gpios = <&gpio 69 0>; /* gpio PI5 */
                wp-gpios = <&gpio 57 0>; /* gpio PH1 */
		vmmc-supply = <&vmmc1>;
                bus-width = <4>;
        };

Any interest in making this change?  I've asked other drivers
(sdhci-pxav3 and sdhci-spear) to do the same thing (although
they hadn't merged their use of power-gpios yet and tegra has).

Thanks,

- Chris.
-- 
Chris Ball   <cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-01 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-01 15:15 sdhci-tegra and power-gpios Chris Ball
     [not found] ` <87vceunrzi.fsf-DGHOrqG7t0YzNDMTQreKSUB+6BGkLq7r@public.gmane.org>
2012-10-01 16:05   ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).