#include <sound/jack.h>
#include <sound/pcm_params.h>
#include <sound/initval.h>
+#include <linux/gpio.h>
#include "intel_sst.h"
#include "intel_sst_ioctl.h"
#include "intel_sst_fw_ipc.h"
ret_val = snd_intelmad_create(intelmaddata, card);
if (ret_val) {
pr_err("snd_intelmad_create failed\n");
- goto set_pvt_data;;
+ goto set_pvt_data;
}
card->private_data = &intelmaddata;
snd_card_set_dev(card, &pdev->dev);
ret_val = snd_card_register(card);
if (ret_val) {
pr_err("snd_card_register failed\n");
- goto set_pvt_data;;
+ goto set_pvt_data;
+ }
+ if (pdev->dev.platform_data) {
+ int gpio_amp = *(int *)pdev->dev.platform_data;
+ if (gpio_request_one(gpio_amp, GPIOF_OUT_INIT_LOW, "amp power"))
+ gpio_amp = 0;
+ intelmaddata->sstdrv_ops->scard_ops->gpio_amp = gpio_amp;
}
pr_debug("snd_intelmad_probe complete\n");
struct snd_intelmad *intelmaddata = platform_get_drvdata(pdev);
if (intelmaddata) {
+ if (intelmaddata->sstdrv_ops->scard_ops->gpio_amp)
+ gpio_free(intelmaddata->sstdrv_ops->scard_ops->gpio_amp);
free_irq(intelmaddata->irq, intelmaddata);
snd_card_free(intelmaddata->card);
}
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/gpio.h>
#include <linux/pci.h>
#include <linux/file.h>
#include <sound/control.h>
AUXDBNC = 0x12f,
};
+static void nc_set_amp_power(int power)
+{
+ if (snd_pmic_ops_nc.gpio_amp)
+ gpio_set_value(snd_pmic_ops_nc.gpio_amp, power);
+}
+
/****
* nc_init_card - initialize the sound card
*
msleep(30);
+ /*
+ * There is a mismatch between Playback Sources and the enumerated
+ * values of output sources. This mismatch causes ALSA upper to send
+ * Item 1 for Internal Speaker, but the expected enumeration is 2! For
+ * now, treat MONO_EARPIECE and INTERNAL_SPKR identically and power up
+ * the needed resources
+ */
+ if (snd_pmic_ops_nc.output_dev_id == MONO_EARPIECE ||
+ snd_pmic_ops_nc.output_dev_id == INTERNAL_SPKR)
+ nc_set_amp_power(1);
return nc_enable_audiodac(UNMUTE);
}
int retval = 0;
struct sc_reg_access sc_access[5];
-
if (snd_pmic_ops_nc.card_status == SND_CARD_UN_INIT)
retval = nc_init_card();
if (retval)
pr_debug("powering dn nc_power_down ....\n");
+ if (snd_pmic_ops_nc.output_dev_id == MONO_EARPIECE ||
+ snd_pmic_ops_nc.output_dev_id == INTERNAL_SPKR)
+ nc_set_amp_power(0);
+
msleep(30);
sc_access[0].reg_addr = DRVPOWERCTRL;
switch (value) {
case STEREO_HEADPHONE:
retval = sst_sc_reg_access(sc_access_HP, PMIC_WRITE, 2);
+ nc_set_amp_power(0);
break;
+ case MONO_EARPIECE:
case INTERNAL_SPKR:
retval = sst_sc_reg_access(sc_access_IS, PMIC_WRITE, 2);
+ nc_set_amp_power(1);
break;
default:
pr_err("rcvd illegal request: %d\n", value);