Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, upstream@semihalf.com,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	harshapriya.n@intel.com, rad@semihalf.com,
	pierre-louis.bossart@linux.intel.com, tiwai@suse.com,
	hdegoede@redhat.com, broonie@kernel.org,
	cujomalainey@chromium.org, lma@semihalf.com
Subject: Re: [PATCH 3/4] ALSA: hda: Update and expose codec register procedures
Date: Wed, 9 Feb 2022 11:21:23 +0100	[thread overview]
Message-ID: <14d6492c-ad72-772c-55ed-2e5d51f3cbdc@intel.com> (raw)
In-Reply-To: <s5hiltpqo0n.wl-tiwai@suse.de>

On 2022-02-08 6:14 PM, Takashi Iwai wrote:
> Hmm, but snd_hda_codec_device_new() also does the actual hardware
> initialization including the power-up sequence, and there is a call
> snd_component_add() with the card instance.  How the function would
> work properly before the card instantiation?  You seem to have handled
> only snd_device_new() and not touching other code where the card (or
> the hardware access) is involved.
> 
> If the purpose is to get the fields of snd_hda_codec to be
> initialized, those init code can be factored out to another function,
> so that it works certainly without card.

I was anticipating snd_hda_codec_device_init() related question so much 
and was so ready for it that I answered like an autobot, regardless of 
fact that people were not asking about snd_hda_codec_device_init() vs 
snd_hda_codec_device_new() directly and that's not even the patch where 
the change is added. And I wasn't even drinking coffee for the past few 
days..

Meh..
In regard to snddev_managed, If I'm not mistaken, the problem is 
connected to the 'dev_ops' (.dev_register, .dev_free) provided for 
snd_device_new(). To have basically 0% custom HDA logic in our code, 
rely solely on code found in sound/hda and sound/pci/hda ability to 
control when snd_hda_codec_register() and snd_hda_codec_unregister() is 
called was needed.

snd_soc_bind_card() invokes snd_card_register() which in consequence 
leads to snd_device_register_all() and that to automatic ->dev_register 
call. That call involves PM operations, and at that moment, codec is not 
ready for it. In the end, ability to call these in correct order allowed 
all codecs that communicate with avs-driver to remain on HDA_DEV_LEGACY 
level.

To answer the remaining question found in your message:
The purpose of the change was not to get the fields of snd_hda_codec out 
of the function and have them initialized elsewhere. All other 
operations found in the snd_hda_codec_device_new() are required and 
their ordering is not problematic so they have been left untouched.


Regards,
Czarek

  reply	other threads:[~2022-02-09 10:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 11:49 [PATCH 0/4] ALSA: hda: Expose codec organization functions Cezary Rojewski
2022-02-07 11:49 ` [PATCH 1/4] ALSA: hda: Add snd_hdac_ext_bus_link_at() helper Cezary Rojewski
2022-02-07 11:49 ` [PATCH 2/4] ALSA: hda: Update and expose snd_hda_codec_device_init() Cezary Rojewski
2022-02-07 11:49 ` [PATCH 3/4] ALSA: hda: Update and expose codec register procedures Cezary Rojewski
2022-02-08 15:54   ` Kai Vehmanen
2022-02-08 16:34     ` Cezary Rojewski
2022-02-08 17:14       ` Takashi Iwai
2022-02-09 10:21         ` Cezary Rojewski [this message]
2022-02-09 10:38           ` Cezary Rojewski
2022-02-09 14:19             ` Takashi Iwai
2022-02-08 17:46       ` Pierre-Louis Bossart
2022-02-09 12:05         ` Cezary Rojewski
2022-02-09 16:08           ` Pierre-Louis Bossart
2022-02-11 14:42             ` Cezary Rojewski
2022-02-11 15:23               ` Pierre-Louis Bossart
2022-02-14  9:54                 ` Cezary Rojewski
2022-02-07 11:49 ` [PATCH 4/4] ALSA: hda: Expose codec cleanup and power-save functions Cezary Rojewski
2022-02-07 12:35 ` [PATCH 0/4] ALSA: hda: Expose codec organization functions Pierre-Louis Bossart
2022-02-08 10:00   ` Cezary Rojewski

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=14d6492c-ad72-772c-55ed-2e5d51f3cbdc@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@chromium.org \
    --cc=harshapriya.n@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lma@semihalf.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rad@semihalf.com \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    --cc=upstream@semihalf.com \
    /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