From 8d93a4beb154adb857ad8eb36270781e29b73883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 23 Sep 2007 20:57:00 +0000 Subject: [PATCH] =?UTF-8?q?patch=20from=20H=C3=BCseyin=20Erdemir:=20his=20?= =?UTF-8?q?laptops=20HP=20nx8220=20didn't=20have=20Headphone=20Jacksense?= =?UTF-8?q?=20working=20as=20is.=20Thanks!=20Some=20other=20HP=20laptops?= =?UTF-8?q?=20have=20this=20problem.=20Maybe=20we=20should=20have=20ac97?= =?UTF-8?q?=20export=20quirks=20and=20the=20driver=20uses=20them.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22284 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/drivers/audio/ac97/auich/ac97.c | 16 +++++++++++++++- .../kernel/drivers/audio/ac97/auich/ac97.h | 1 + .../kernel/drivers/audio/ac97/auich/auich.c | 2 ++ .../kernel/drivers/audio/ac97/auich/config.h | 3 +++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.c b/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.c index 086cf91e44..a471540ecd 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.c +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.c @@ -95,12 +95,14 @@ typedef struct codec_table_tag void default_init(device_config *); void ad1886_init(device_config *); +void ad1981b_init(device_config *); void default_amp_enable(device_config *, bool); void cs4299_amp_enable(device_config *, bool); codec_ops default_ops = { default_init, default_amp_enable }; codec_ops ad1886_ops = { ad1886_init, default_amp_enable }; +codec_ops ad1981b_ops = { ad1981b_init, default_amp_enable }; codec_ops cs4299_ops = { default_init, cs4299_amp_enable }; codec_table codecs[] = @@ -150,6 +152,7 @@ codec_table codecs[] = { 0x41445363, 0xffffffff, &default_ops, "Analog Devices AD1886A SoundMAX"B_UTF8_REGISTERED }, { 0x41445371, 0xffffffff, &default_ops, "Analog Devices AD1981A SoundMAX"B_UTF8_REGISTERED }, { 0x41445372, 0xffffffff, &default_ops, "Analog Devices AD1981A SoundMAX"B_UTF8_REGISTERED }, + { 0x41445374, 0xffffffff, &ad1981b_ops, "Analog Devices AD1981B SoundMAX"B_UTF8_REGISTERED }, { 0x414c4320, 0xfffffff0, &default_ops, "Avance Logic (Realtek) ALC100/ALC100P, RL5383/RL5522" }, { 0x414c4730, 0xffffffff, &default_ops, "Avance Logic (Realtek) ALC101" }, #if 0 @@ -251,7 +254,18 @@ void default_init(device_config *config) void ad1886_init(device_config *config) { LOG(("ad1886_init\n")); - auich_codec_write(config, 0x72, 0x0010); + auich_codec_write(config, AC97_AD_JACKSENSE, 0x0010); +} + +void ad1981b_init(device_config *config) +{ + uint32 id; + LOG(("ad1981b_init\n")); + id = (config->subvendor_id << 16) | config->subsystem_id; + if (id == 0x103c0934) { + auich_codec_write(config, AC97_AD_JACKSENSE, + auich_codec_read(config, AC97_AD_JACKSENSE) | 0x0800); + } } void default_amp_enable(device_config *config, bool yesno) diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.h b/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.h index 9972b42a72..69319f17df 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.h +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/ac97.h @@ -64,6 +64,7 @@ enum AC97_REGISTER { AC97_CENTER_LFE_VOLUME = 0x36, AC97_SURROUND_VOLUME = 0x38, AC97_SPDIF_CONTROL = 0x3A, + AC97_AD_JACKSENSE = 0x72, AC97_VENDOR_ID1 = 0x7C, AC97_VENDOR_ID2 = 0x7E }; diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c index eac9d90194..f4ec5f5f8e 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c @@ -607,6 +607,8 @@ auich_setup(auich_dev * card) make_device_names(card); + card->config.subvendor_id = card->info.u.h0.subsystem_vendor_id; + card->config.subsystem_id = card->info.u.h0.subsystem_id; card->config.nabmbar = card->info.u.h0.base_registers[0]; card->config.irq = card->info.u.h0.interrupt_line; card->config.type = 0; diff --git a/src/add-ons/kernel/drivers/audio/ac97/auich/config.h b/src/add-ons/kernel/drivers/audio/ac97/auich/config.h index fbd30ff54c..18971d97c1 100644 --- a/src/add-ons/kernel/drivers/audio/ac97/auich/config.h +++ b/src/add-ons/kernel/drivers/audio/ac97/auich/config.h @@ -46,6 +46,9 @@ typedef struct void * log_mbbar; // ich4 area_id area_mmbar; // ich4 area_id area_mbbar; // ich4 + + ushort subvendor_id; + ushort subsystem_id; } device_config; #define TYPE_ICH4 0x01