Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9791ca0 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

Merge branch 'topic/hda-patch' into topic/hda

parents 546861f1 1e7b8c87
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -768,6 +768,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
    bdl_pos_adj	- Specifies the DMA IRQ timing delay in samples.
		Passing -1 will make the driver to choose the appropriate
		value based on the controller chip.
    patch	- Specifies the early "patch" files to modify the HD-audio
    		setup before initializing the codecs.  This option is
		available only when CONFIG_SND_HDA_PATCH_LOADER=y is set.
		See HD-Audio.txt for details.
    
    [Single (global) options]
    single_cmd  - Use single immediate commands to communicate with
+60 −0
Original line number Diff line number Diff line
@@ -403,6 +403,66 @@ re-configure based on that state, run like below:
------------------------------------------------------------------------


Early Patching
~~~~~~~~~~~~~~
When CONFIG_SND_HDA_PATCH_LOADER=y is set, you can pass a "patch" as a
firmware file for modifying the HD-audio setup before initializing the
codec.  This can work basically like the reconfiguration via sysfs in
the above, but it does it before the first codec configuration.

A patch file is a plain text file which looks like below:

------------------------------------------------------------------------
  [codec]
  0x12345678 0xabcd1234 2

  [model]
  auto

  [pincfg]
  0x12 0x411111f0

  [verb]
  0x20 0x500 0x03
  0x20 0x400 0xff

  [hint]
  hp_detect = yes
------------------------------------------------------------------------

The file needs to have a line `[codec]`.  The next line should contain
three numbers indicating the codec vendor-id (0x12345678 in the
example), the codec subsystem-id (0xabcd1234) and the address (2) of
the codec.  The rest patch entries are applied to this specified codec
until another codec entry is given.

The `[model]` line allows to change the model name of the each codec.
In the example above, it will be changed to model=auto.
Note that this overrides the module option.

After the `[pincfg]` line, the contents are parsed as the initial
default pin-configurations just like `user_pin_configs` sysfs above.
The values can be shown in user_pin_configs sysfs file, too.

Similarly, the lines after `[verb]` are parsed as `init_verbs`
sysfs entries, and the lines after `[hint]` are parsed as `hints`
sysfs entries, respectively.

The hd-audio driver reads the file via request_firmware().  Thus,
a patch file has to be located on the appropriate firmware path,
typically, /lib/firmware.  For example, when you pass the option
`patch=hda-init.fw`, the file /lib/firmware/hda-init-fw must be
present.

The patch module option is specific to each card instance, and you
need to give one file name for each instance, separated by commas.
For example, if you have two cards, one for an on-board analog and one 
for an HDMI video board, you may pass patch option like below:
------------------------------------------------------------------------
    options snd-hda-intel patch=on-board-patch,hdmi-patch
------------------------------------------------------------------------


Power-Saving
~~~~~~~~~~~~
The power-saving is a kind of auto-suspend of the device.  When the
+14 −0
Original line number Diff line number Diff line
@@ -46,6 +46,20 @@ config SND_HDA_INPUT_JACK
	  Say Y here to enable the jack plugging notification via
	  input layer.

config SND_HDA_PATCH_LOADER
	bool "Support initialization patch loading for HD-audio"
	depends on EXPERIMENTAL
	select FW_LOADER
	select SND_HDA_HWDEP
	select SND_HDA_RECONFIG
	help
	  Say Y here to allow the HD-audio driver to load a pseudo
	  firmware file ("patch") for overriding the BIOS setup at
	  start up.  The "patch" file can be specified via patch module
	  option, such as patch=hda-init.

	  This option turns on hwdep and reconfig features automatically.

config SND_HDA_CODEC_REALTEK
	bool "Build Realtek HD-audio codec support"
	default y
+2 −6
Original line number Diff line number Diff line
@@ -885,7 +885,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
 * Returns 0 if successful, or a negative error code.
 */
int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
				    int do_init, struct hda_codec **codecp)
				    struct hda_codec **codecp)
{
	struct hda_codec *codec;
	char component[31];
@@ -978,11 +978,6 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr
			    codec->afg ? codec->afg : codec->mfg,
			    AC_PWRST_D0);

	if (do_init) {
		err = snd_hda_codec_configure(codec);
		if (err < 0)
			goto error;
	}
	snd_hda_codec_proc_new(codec);

	snd_hda_create_hwdep(codec);
@@ -1036,6 +1031,7 @@ int snd_hda_codec_configure(struct hda_codec *codec)
		err = init_unsol_queue(codec->bus);
	return err;
}
EXPORT_SYMBOL_HDA(snd_hda_codec_configure);

/**
 * snd_hda_codec_setup_stream - set up the codec for streaming
+9 −1
Original line number Diff line number Diff line
@@ -830,7 +830,8 @@ enum {
int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
		    struct hda_bus **busp);
int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
		      int do_init, struct hda_codec **codecp);
		      struct hda_codec **codecp);
int snd_hda_codec_configure(struct hda_codec *codec);

/*
 * low level functions
@@ -938,6 +939,13 @@ static inline void snd_hda_power_down(struct hda_codec *codec) {}
#define snd_hda_codec_needs_resume(codec) 1
#endif

#ifdef CONFIG_SND_HDA_PATCH_LOADER
/*
 * patch firmware
 */
int snd_hda_load_patch(struct hda_bus *bus, const char *patch);
#endif

/*
 * Codec modularization
 */
Loading