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

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

Merge branch 'topic/hda-power' into for-next

parents b24062bd 5ccf835c
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -33,30 +33,36 @@ enum {
	DIGBEEP_HZ_MAX = 12000000,	/* 12 KHz */
};

static void snd_hda_generate_beep(struct work_struct *work)
/* generate or stop tone */
static void generate_tone(struct hda_beep *beep, int tone)
{
	struct hda_beep *beep =
		container_of(work, struct hda_beep, beep_work);
	struct hda_codec *codec = beep->codec;
	int tone;

	if (!beep->enabled)
		return;

	tone = beep->tone;
	if (tone && !beep->playing) {
		snd_hda_power_up(codec);
		if (beep->power_hook)
			beep->power_hook(beep, true);
		beep->playing = 1;
	}
	/* generate tone */
	snd_hda_codec_write(codec, beep->nid, 0,
			    AC_VERB_SET_BEEP_CONTROL, tone);
	if (!tone && beep->playing) {
		beep->playing = 0;
		if (beep->power_hook)
			beep->power_hook(beep, false);
		snd_hda_power_down(codec);
	}
}

static void snd_hda_generate_beep(struct work_struct *work)
{
	struct hda_beep *beep =
		container_of(work, struct hda_beep, beep_work);

	if (beep->enabled)
		generate_tone(beep, beep->tone);
}

/* (non-standard) Linear beep tone calculation for IDT/STAC codecs 
 *
 * The tone frequency of beep generator on IDT/STAC codecs is
@@ -130,10 +136,7 @@ static void turn_off_beep(struct hda_beep *beep)
	cancel_work_sync(&beep->beep_work);
	if (beep->playing) {
		/* turn off beep */
		snd_hda_codec_write(beep->codec, beep->nid, 0,
				    AC_VERB_SET_BEEP_CONTROL, 0);
		beep->playing = 0;
		snd_hda_power_down(beep->codec);
		generate_tone(beep, 0);
	}
}

+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ struct hda_beep {
	unsigned int playing:1;
	struct work_struct beep_work; /* scheduled task for beep event */
	struct mutex mutex;
	void (*power_hook)(struct hda_beep *beep, bool on);
};

#ifdef CONFIG_SND_HDA_INPUT_BEEP
+4 −0
Original line number Diff line number Diff line
@@ -1502,6 +1502,8 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
	if (!p)
		return;

	if (codec->patch_ops.stream_pm)
		codec->patch_ops.stream_pm(codec, nid, true);
	if (codec->pcm_format_first)
		update_pcm_format(codec, p, nid, format);
	update_pcm_stream_id(codec, p, nid, stream_tag, channel_id);
@@ -1570,6 +1572,8 @@ static void really_cleanup_stream(struct hda_codec *codec,
);
	memset(q, 0, sizeof(*q));
	q->nid = nid;
	if (codec->patch_ops.stream_pm)
		codec->patch_ops.stream_pm(codec, nid, false);
}

/* clean up the all conflicting obsolete streams */
+2 −0
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ struct hda_codec_ops {
	int (*check_power_status)(struct hda_codec *codec, hda_nid_t nid);
#endif
	void (*reboot_notify)(struct hda_codec *codec);
	void (*stream_pm)(struct hda_codec *codec, hda_nid_t nid, bool on);
};

/* record for amp information cache */
@@ -370,6 +371,7 @@ struct hda_codec {
	unsigned int cached_write:1;	/* write only to caches */
	unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */
	unsigned int dump_coef:1; /* dump processing coefs in codec proc file */
	unsigned int power_mgmt:1; /* advanced PM for each widget */
#ifdef CONFIG_PM
	unsigned int d3_stop_clk:1;	/* support D3 operation without BCLK */
	atomic_t in_pm;		/* suspend/resume being performed */
+383 −97

File changed.

Preview size limit exceeded, changes collapsed.

Loading