Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
From: Philip Molloy <philip@philipmolloy.com>
To: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Subject: Power domain configuration for a i2c module
Date: Thu, 15 Aug 2019 15:57:45 +0000
Message-ID: <IhUuEbYWNmzYrxy4xrqraNXsMwsBC-QMPC9NIy4JyxfW2J8ViOwTNj4zy9K_pNbZdhJixkAFJSPOc9oJ9IleeYBsEIkPGK_cU11OhzDfJ3M=@philipmolloy.com> (raw)
In-Reply-To: <LBvyayNVX8_SOsSXpNSqiBACOGjM2Bu-Fz-D_gW850M9ZJQVEk6WVxzipUn9O4n15435v4yHSIVYp0HgKUcSkTt_hTIEA3XZ0FZLSyEKipY=@philipmolloy.com>

Hello,

I've setup a power domain, but I'm having trouble understanding how the domain's power management callbacks are called when a i2c driver is probed.

The domain is intended to cover two external modules. The power to both modules is controlled by a single GPIO. I intend to add several drivers to the domain including drivers for several i2c devices and a MMIO driver to access data streamed from the modules. I've started with one provider and two consumers.

The provider calls pm_genpd_init() and of_genpd_add_provider_simple(). It also implements power_on() and power_of().

provider@0 {
    ...
    power-gpio = <&gpio XX GPIO_ACTIVE_HIGH>;
    ready-gpio = <&gpio XX GPIO_ACTIVE_HIGH>;
    #power-domain-cells = <0>;
};

The consumers are two physical I2C switches:

i2c-mux-gpio {
    compatible = "i2c-mux-gpio";
    ...

    module@1 {
        ...

        tca9543@70 {
            compatible = "nxp,pca943";
            ...
            power-domains = <&provider 0>;
            power-domain-names = "provider";
        };
    };

    module@2 {
        // Same as above
    };
};

When I modprobe i2c-mux-mpca954x it is successfully added to the domain, but probe fails when calling i2c_smbus_write_byte() to verify the mux is present. That is because the modules are not powered on, because the power domain callbacks were not called.

I feel like there are a number of ways this could work. My assumption would be that the i2c driver subsystem would make sure the device is powered on before probe is called. i2c_device_probe() does call dev_pm_domain_attach() before calling driver->probe(), but I don't see where it would power on the device. i2c-mux-pca954x implements a resume callback so I assume it doesn't require any changes.

Any clarity would be greatly appreciated.

Best,
Philip

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 22:18 Philip Molloy
2019-08-15 15:57 ` Philip Molloy [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='IhUuEbYWNmzYrxy4xrqraNXsMwsBC-QMPC9NIy4JyxfW2J8ViOwTNj4zy9K_pNbZdhJixkAFJSPOc9oJ9IleeYBsEIkPGK_cU11OhzDfJ3M=@philipmolloy.com' \
    --to=philip@philipmolloy.com \
    --cc=khilman@baylibre.com \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org linux-pm@archiver.kernel.org
	public-inbox-index linux-pm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox