All of lore.kernel.org
 help / color / mirror / Atom feed
From: asd <asd@marian1000.go.ro>
To: Alsa-devel@alsa-project.org
Subject: Patch for power on headphone amp on Realtek 883
Date: Mon, 09 Jun 2014 10:06:59 +0300	[thread overview]
Message-ID: <1552287.TJAWsn00qn@marian1000.go.ro> (raw)

[-- Attachment #1: parch_realtek_new.patch --]
[-- Type: text/x-patch, Size: 3560 bytes --]

Index: hda/hda_codec.h
===================================================================
--- hda.orig/hda_codec.h	2014-06-08 22:54:07.000000000 +0300
+++ hda/hda_codec.h	2014-06-09 09:43:42.359115743 +0300
@@ -259,6 +259,7 @@
 	HDA_PCM_NTYPES
 };
 
+
 /* for PCM creation */
 struct hda_pcm {
 	char *name;
@@ -287,6 +288,14 @@
 	u32 subsystem_id;
 	u32 revision_id;
 
+	/* custom pin complex headphone amp */
+	bool hp_set;
+	hda_nid_t hp_front;
+	hda_nid_t hp_rear;
+	hda_nid_t hp_clfe;
+	hda_nid_t hp_side;
+	hda_nid_t hp_fout;
+
 	/* detected preset */
 	const struct hda_codec_preset *preset;
 	struct module *owner;
Index: hda/patch_realtek.c
===================================================================
--- hda.orig/patch_realtek.c	2014-06-07 12:38:24.000000000 +0300
+++ hda/patch_realtek.c	2014-06-09 09:22:53.306622242 +0300
@@ -322,6 +322,12 @@
 		case 0x10ec0880:
 		case 0x10ec0882:
 		case 0x10ec0883:
+			codec->hp_set = 1;
+			codec->hp_front = 0x14;
+			codec->hp_rear = 0x15;
+			codec->hp_clfe = 0x16;
+			codec->hp_side = 0x17;
+			codec->hp_fout = 0x1b;
 		case 0x10ec0885:
 		case 0x10ec0887:
 		/*case 0x10ec0889:*/ /* this causes an SPDIF problem */
Index: hda/hda_codec.c
===================================================================
--- hda.orig/hda_codec.c	2014-06-08 22:54:07.000000000 +0300
+++ hda/hda_codec.c	2014-06-09 09:45:32.473468469 +0300
@@ -27,6 +27,7 @@
 #include <linux/mutex.h>
 #include <linux/module.h>
 #include <linux/async.h>
+#include <linux/delay.h>
 #include <sound/core.h>
 #include "hda_codec.h"
 #include <sound/asoundef.h>
@@ -120,6 +121,56 @@
 #define hda_call_pm_notify(codec, state) {}
 #endif
 
+static void enable_hp_codec(struct hda_codec *codec)
+{
+
+	mutex_unlock(&codec->control_mutex);
+	if ((codec->hp_set = 1)) {
+	snd_hda_codec_write(codec, codec->hp_front, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0);
+
+	snd_hda_codec_write(codec, codec->hp_rear, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0);
+
+	snd_hda_codec_write(codec, codec->hp_clfe, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0);
+
+	snd_hda_codec_write(codec, codec->hp_side, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0);
+
+	snd_hda_codec_write(codec, codec->hp_fout, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0);
+	} 
+
+	mutex_lock(&codec->control_mutex);
+
+}
+
+static void mute_all_analog_outs(struct hda_codec *codec)
+{
+	mutex_unlock(&codec->control_mutex);
+	if ((codec->hp_set = 1)) {
+	snd_hda_codec_write(codec,codec->hp_front, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+	snd_hda_codec_write(codec,codec->hp_rear, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+	snd_hda_codec_write(codec,codec->hp_clfe, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+	snd_hda_codec_write(codec,codec->hp_side, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+
+	snd_hda_codec_write(codec,codec->hp_fout, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
+	}
+	mutex_lock(&codec->control_mutex);
+}
+
+
+
+
 /**
  * snd_hda_get_jack_location - Give a location string of the jack
  * @cfg: pin default config value
@@ -5418,8 +5469,9 @@
 				/* FIXME: need notify? */
 			}
 		}
-		mutex_unlock(&codec->spdif_mutex);
+		mutex_unlock(&codec->spdif_mutex);    
 	}
+	enable_hp_codec(codec);
 	return snd_pcm_hw_constraint_step(substream->runtime, 0,
 					  SNDRV_PCM_HW_PARAM_CHANNELS, 2);
 }
@@ -5530,6 +5582,7 @@
 		mout->dig_out_used = 0;
 	}
 	mutex_unlock(&codec->spdif_mutex);
+	mute_all_analog_outs(codec);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_cleanup);

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



             reply	other threads:[~2014-06-09  7:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09  7:06 asd [this message]
2014-06-09  7:28 ` Patch for power on headphone amp on Realtek 883 Takashi Iwai

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=1552287.TJAWsn00qn@marian1000.go.ro \
    --to=asd@marian1000.go.ro \
    --cc=Alsa-devel@alsa-project.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.