Commit 873591db authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai

sound: oxygen: enable headphone output on Claro cards

On the HT-Omega Claro (halo) sound cards, the headphone amplifier must
be enabled explicitly by setting a GPIO bit.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 82af308f
/* /*
* C-Media CMI8788 driver for C-Media's reference design and for the X-Meridian * C-Media CMI8788 driver for C-Media's reference design and similar models
* *
* Copyright (c) Clemens Ladisch <clemens@ladisch.de> * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
* *
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
* *
* GPIO 0 -> DFS0 of AK5385 * GPIO 0 -> DFS0 of AK5385
* GPIO 1 -> DFS1 of AK5385 * GPIO 1 -> DFS1 of AK5385
* GPIO 8 -> enable headphone amplifier on HT-Omega models
*/ */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -61,7 +62,8 @@ MODULE_PARM_DESC(enable, "enable card"); ...@@ -61,7 +62,8 @@ MODULE_PARM_DESC(enable, "enable card");
enum { enum {
MODEL_CMEDIA_REF, /* C-Media's reference design */ MODEL_CMEDIA_REF, /* C-Media's reference design */
MODEL_MERIDIAN, /* AuzenTech X-Meridian */ MODEL_MERIDIAN, /* AuzenTech X-Meridian */
MODEL_HALO, /* HT-Omega Claro halo */ MODEL_CLARO, /* HT-Omega Claro */
MODEL_CLARO_HALO, /* HT-Omega Claro halo */
}; };
static struct pci_device_id oxygen_ids[] __devinitdata = { static struct pci_device_id oxygen_ids[] __devinitdata = {
...@@ -74,8 +76,8 @@ static struct pci_device_id oxygen_ids[] __devinitdata = { ...@@ -74,8 +76,8 @@ static struct pci_device_id oxygen_ids[] __devinitdata = {
{ OXYGEN_PCI_SUBID(0x147a, 0xa017), .driver_data = MODEL_CMEDIA_REF }, { OXYGEN_PCI_SUBID(0x147a, 0xa017), .driver_data = MODEL_CMEDIA_REF },
{ OXYGEN_PCI_SUBID(0x1a58, 0x0910), .driver_data = MODEL_CMEDIA_REF }, { OXYGEN_PCI_SUBID(0x1a58, 0x0910), .driver_data = MODEL_CMEDIA_REF },
{ OXYGEN_PCI_SUBID(0x415a, 0x5431), .driver_data = MODEL_MERIDIAN }, { OXYGEN_PCI_SUBID(0x415a, 0x5431), .driver_data = MODEL_MERIDIAN },
{ OXYGEN_PCI_SUBID(0x7284, 0x9761), .driver_data = MODEL_CMEDIA_REF }, { OXYGEN_PCI_SUBID(0x7284, 0x9761), .driver_data = MODEL_CLARO },
{ OXYGEN_PCI_SUBID(0x7284, 0x9781), .driver_data = MODEL_HALO }, { OXYGEN_PCI_SUBID(0x7284, 0x9781), .driver_data = MODEL_CLARO_HALO },
{ } { }
}; };
MODULE_DEVICE_TABLE(pci, oxygen_ids); MODULE_DEVICE_TABLE(pci, oxygen_ids);
...@@ -86,6 +88,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids); ...@@ -86,6 +88,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids);
#define GPIO_AK5385_DFS_DOUBLE 0x0001 #define GPIO_AK5385_DFS_DOUBLE 0x0001
#define GPIO_AK5385_DFS_QUAD 0x0002 #define GPIO_AK5385_DFS_QUAD 0x0002
#define GPIO_CLARO_HP 0x0100
struct generic_data { struct generic_data {
u8 ak4396_ctl2; u8 ak4396_ctl2;
u16 saved_wm8785_registers[2]; u16 saved_wm8785_registers[2];
...@@ -196,16 +200,46 @@ static void meridian_init(struct oxygen *chip) ...@@ -196,16 +200,46 @@ static void meridian_init(struct oxygen *chip)
ak5385_init(chip); ak5385_init(chip);
} }
static void halo_init(struct oxygen *chip) static void claro_enable_hp(struct oxygen *chip)
{
msleep(300);
oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_CLARO_HP);
oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_CLARO_HP);
}
static void claro_init(struct oxygen *chip)
{
ak4396_init(chip);
wm8785_init(chip);
claro_enable_hp(chip);
}
static void claro_halo_init(struct oxygen *chip)
{ {
ak4396_init(chip); ak4396_init(chip);
ak5385_init(chip); ak5385_init(chip);
claro_enable_hp(chip);
} }
static void generic_cleanup(struct oxygen *chip) static void generic_cleanup(struct oxygen *chip)
{ {
} }
static void claro_disable_hp(struct oxygen *chip)
{
oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, GPIO_CLARO_HP);
}
static void claro_cleanup(struct oxygen *chip)
{
claro_disable_hp(chip);
}
static void claro_suspend(struct oxygen *chip)
{
claro_disable_hp(chip);
}
static void generic_resume(struct oxygen *chip) static void generic_resume(struct oxygen *chip)
{ {
ak4396_registers_init(chip); ak4396_registers_init(chip);
...@@ -217,9 +251,10 @@ static void meridian_resume(struct oxygen *chip) ...@@ -217,9 +251,10 @@ static void meridian_resume(struct oxygen *chip)
ak4396_registers_init(chip); ak4396_registers_init(chip);
} }
static void halo_resume(struct oxygen *chip) static void claro_resume(struct oxygen *chip)
{ {
ak4396_registers_init(chip); ak4396_registers_init(chip);
claro_enable_hp(chip);
} }
static void set_ak4396_params(struct oxygen *chip, static void set_ak4396_params(struct oxygen *chip,
...@@ -346,14 +381,22 @@ static int __devinit get_oxygen_model(struct oxygen *chip, ...@@ -346,14 +381,22 @@ static int __devinit get_oxygen_model(struct oxygen *chip,
CAPTURE_0_FROM_I2S_2 | CAPTURE_0_FROM_I2S_2 |
CAPTURE_1_FROM_SPDIF; CAPTURE_1_FROM_SPDIF;
break; break;
case MODEL_HALO: case MODEL_CLARO:
chip->model.init = halo_init; chip->model.init = claro_init;
chip->model.resume = halo_resume; chip->model.cleanup = claro_cleanup;
chip->model.suspend = claro_suspend;
chip->model.resume = claro_resume;
break;
case MODEL_CLARO_HALO:
chip->model.init = claro_halo_init;
chip->model.cleanup = claro_cleanup;
chip->model.suspend = claro_suspend;
chip->model.resume = claro_resume;
chip->model.set_adc_params = set_ak5385_params; chip->model.set_adc_params = set_ak5385_params;
break; break;
} }
if (id->driver_data == MODEL_MERIDIAN || if (id->driver_data == MODEL_MERIDIAN ||
id->driver_data == MODEL_HALO) { id->driver_data == MODEL_CLARO_HALO) {
chip->model.misc_flags = OXYGEN_MISC_MIDI; chip->model.misc_flags = OXYGEN_MISC_MIDI;
chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT; chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment