devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	broonie@kernel.org, lee.jones@linaro.org,
	linus.walleij@linaro.org
Cc: robh@kernel.org, alsa-devel@alsa-project.org,
	bgoswami@codeaurora.org, vinod.koul@linaro.org,
	devicetree@vger.kernel.org, spapothi@codeaurora.org,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH v6 02/11] mfd: wcd934x: add support to wcd9340/wcd9341 codec
Date: Thu, 19 Dec 2019 17:28:38 +0000	[thread overview]
Message-ID: <db36d6d7-40a2-bbd2-f299-838abf4d92cc@linaro.org> (raw)
In-Reply-To: <af48cd71-fa1a-dbc5-0e88-e315ea13c28c@linux.intel.com>



On 19/12/2019 16:36, Pierre-Louis Bossart wrote:
> 
>> +static int wcd934x_slim_status(struct slim_device *sdev,
>> +                   enum slim_device_status status)
>> +{
>> +    switch (status) {
>> +    case SLIM_DEVICE_STATUS_UP:
>> +        return wcd934x_slim_status_up(sdev);
>> +    case SLIM_DEVICE_STATUS_DOWN:
>> +        mfd_remove_devices(&sdev->dev);
>> +        break;
>> +    default:
>> +        return -EINVAL;
>> +    }
>> +
>> +    return 0;
>> +}
>> +
> 
> this is interesting/surprising - I just noticed what looks like a 
> significant change in how probe/initialization are handled.
> 
> It was my understanding that in SLIMbus the Linux devices are created at 
> probe time, and when the device reports present this 'device_status' 
> callback is used to notify the codec driver of a change. The rationale 
> for this was that the codec driver may control power switches/gpios that 
> are necessary for the device to appear on the bus.

We use same rational here to power switch and flip reset pins in device 
probe to power up the actual SLIMBus device in device probe.

Only difference here is that the actual SLIMBus device itself is 
represented as many child devices based on there functionality.

SLIMBus parent device in this case is MFD device which is created at 
probe time. However child devices for that device like gpio controller, 
codec, clock controller and soundwire controller are created only after 
the device is enumerated on the bus. Before that none of these devices 
will be in a position to talk on the bus.


> 
> This argument was used to require an change in the SoundWire 
> implementation, so we followed this model of creating devices at probe 
> time based on information reported by ACPI/DT, and used the 
> 'update_status' callback when the device is present on the bus (which 
> may happen after a delay or controlled by an external power switch). 
> This approach can lead to 'ghost devices' described in firmware but not 
> populated in hardware, and power management opens on how long a bus 
> needs to remain active if no devices report present.
> 
> What I understand from the code above is that the devices are actually 
> created when the SLIMbus device reports PRESENT, which seems a 180 
> degree change in directions?
> 
Note these are the child devices of the MFD SLIMBus device.


> I actually prefer it this way, and all current discussions in MIPI 
> circles point to the fact that when the bus starts all devices on that 
> bus should already be powered and have the ability to report present 
> immediately (if the bus starts in a 'safe' mode and then later programs 
> different PHY parameters, a device can no longer join the bus)

In our case we need to switch on few regulators and flip the reset pio 
to be able to bring the device to enumerate.

> 
> I would however not remove the devices when the status is down but only 
> on an explicit .remove.

Am open for suggestions but I would not like the child devices to talk 
on the bus once the SLIMbus device is down! Only way to ensure or make 
it silent is to remove.

Thanks,
srini
> 
> Feedback welcome.
> -Pierre
> 

  reply	other threads:[~2019-12-19 17:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 10:31 [PATCH v6 00/11] ASoC: Add support to WCD9340/WCD9341 codec Srinivas Kandagatla
2019-12-19 10:31 ` [PATCH v6 01/11] ASoC: dt-bindings: add dt bindings for WCD9340/WCD9341 audio codec Srinivas Kandagatla
2019-12-19 10:31 ` [PATCH v6 02/11] mfd: wcd934x: add support to wcd9340/wcd9341 codec Srinivas Kandagatla
2019-12-19 16:36   ` [alsa-devel] " Pierre-Louis Bossart
2019-12-19 17:28     ` Srinivas Kandagatla [this message]
2019-12-19 20:05       ` Pierre-Louis Bossart
2019-12-20 10:27         ` Srinivas Kandagatla
2019-12-20 15:22           ` Pierre-Louis Bossart
2020-01-22  9:55   ` Srinivas Kandagatla
2020-01-29 11:18   ` Lee Jones
2019-12-19 10:31 ` [PATCH v6 03/11] ASoC: " Srinivas Kandagatla
2019-12-25 18:21   ` Applied "ASoC: wcd934x: add support to wcd9340/wcd9341 codec" to the asoc tree Mark Brown
2019-12-19 10:31 ` [PATCH v6 04/11] ASoC: wcd934x: add basic controls Srinivas Kandagatla
2019-12-19 10:31 ` [PATCH v6 05/11] ASoC: wcd934x: add playback dapm widgets Srinivas Kandagatla
2019-12-19 10:31 ` [PATCH v6 06/11] ASoC: wcd934x: add capture " Srinivas Kandagatla
2019-12-19 10:31 ` [PATCH v6 07/11] ASoC: wcd934x: add audio routings Srinivas Kandagatla
2019-12-19 10:31 ` [PATCH v6 08/11] dt-bindings: gpio: wcd934x: Add bindings for gpio Srinivas Kandagatla
2020-01-07  9:47   ` Linus Walleij
2020-01-07 10:17     ` Srinivas Kandagatla
2020-01-07 22:28       ` Rob Herring
2019-12-19 10:31 ` [PATCH v6 09/11] gpio: wcd934x: Add support to wcd934x gpio controller Srinivas Kandagatla
2020-01-07  9:48   ` Linus Walleij
2019-12-19 10:31 ` [PATCH v6 10/11] ASoC: qcom: dt-bindings: Add compatible for DB845c and Lenovo Yoga Srinivas Kandagatla
2019-12-19 10:31 ` [PATCH v6 11/11] ASoC: qcom: sdm845: add support to " Srinivas Kandagatla

Reply instructions:

You may reply publicly 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=db36d6d7-40a2-bbd2-f299-838abf4d92cc@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgoswami@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=robh@kernel.org \
    --cc=spapothi@codeaurora.org \
    --cc=vinod.koul@linaro.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).