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

Commit 0efebaa7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Fix S3/S4 problem on machines with VREF-pin mute-LED
  ALSA: hda_intel - revert a quirk that affect VIA chipsets
  ALSA: hda - Avoid touching mute-VREF pin for IDT codecs
  firmware: Sigma: Fix endianess issues
  firmware: Sigma: Skip header during CRC generation
  firmware: Sigma: Prevent out of bounds memory access
  ALSA: usb-audio - Support for Roland GAIA SH-01 Synthesizer
  ASoC: Supply dcs_codes for newer WM1811 revisions
  ASoC: Error out if we can't generate a LRCLK at all for WM8994
  ASoC: Correct name of Speyside Main Speaker widget
  ASoC: skip resume of soc-audio devices without codecs
  ASoC: cs42l51: Fix off-by-one for reg_cache_size
  ASoC: drop support for PlayPaq with WM8510
  ASoC: mpc8610: tell the CS4270 codec that it's the master
  ASoC: cs4720: use snd_soc_cache_sync()
  ASoC: SAMSUNG: Fix build error
  ASoC: max9877: Update register if either val or val2 is changed
  ASoC: Fix wrong define for AD1836_ADC_WORD_OFFSET
parents 5983fe2b cf54d47c
Loading
Loading
Loading
Loading
+58 −23
Original line number Original line Diff line number Diff line
@@ -14,13 +14,34 @@
#include <linux/module.h>
#include <linux/module.h>
#include <linux/sigma.h>
#include <linux/sigma.h>


/* Return: 0==OK, <0==error, =1 ==no more actions */
static size_t sigma_action_size(struct sigma_action *sa)
{
	size_t payload = 0;

	switch (sa->instr) {
	case SIGMA_ACTION_WRITEXBYTES:
	case SIGMA_ACTION_WRITESINGLE:
	case SIGMA_ACTION_WRITESAFELOAD:
		payload = sigma_action_len(sa);
		break;
	default:
		break;
	}

	payload = ALIGN(payload, 2);

	return payload + sizeof(struct sigma_action);
}

/*
 * Returns a negative error value in case of an error, 0 if processing of
 * the firmware should be stopped after this action, 1 otherwise.
 */
static int
static int
process_sigma_action(struct i2c_client *client, struct sigma_firmware *ssfw)
process_sigma_action(struct i2c_client *client, struct sigma_action *sa)
{
{
	struct sigma_action *sa = (void *)(ssfw->fw->data + ssfw->pos);
	size_t len = sigma_action_len(sa);
	size_t len = sigma_action_len(sa);
	int ret = 0;
	int ret;


	pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__,
	pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__,
		sa->instr, sa->addr, len);
		sa->instr, sa->addr, len);
@@ -29,44 +50,50 @@ process_sigma_action(struct i2c_client *client, struct sigma_firmware *ssfw)
	case SIGMA_ACTION_WRITEXBYTES:
	case SIGMA_ACTION_WRITEXBYTES:
	case SIGMA_ACTION_WRITESINGLE:
	case SIGMA_ACTION_WRITESINGLE:
	case SIGMA_ACTION_WRITESAFELOAD:
	case SIGMA_ACTION_WRITESAFELOAD:
		if (ssfw->fw->size < ssfw->pos + len)
			return -EINVAL;
		ret = i2c_master_send(client, (void *)&sa->addr, len);
		ret = i2c_master_send(client, (void *)&sa->addr, len);
		if (ret < 0)
		if (ret < 0)
			return -EINVAL;
			return -EINVAL;
		break;
		break;

	case SIGMA_ACTION_DELAY:
	case SIGMA_ACTION_DELAY:
		ret = 0;
		udelay(len);
		udelay(len);
		len = 0;
		len = 0;
		break;
		break;

	case SIGMA_ACTION_END:
	case SIGMA_ACTION_END:
		return 1;
		return 0;

	default:
	default:
		return -EINVAL;
		return -EINVAL;
	}
	}


	/* when arrive here ret=0 or sent data */
	return 1;
	ssfw->pos += sigma_action_size(sa, len);
	return ssfw->pos == ssfw->fw->size;
}
}


static int
static int
process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw)
process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw)
{
{
	pr_debug("%s: processing %p\n", __func__, ssfw);
	struct sigma_action *sa;
	size_t size;
	int ret;

	while (ssfw->pos + sizeof(*sa) <= ssfw->fw->size) {
		sa = (struct sigma_action *)(ssfw->fw->data + ssfw->pos);

		size = sigma_action_size(sa);
		ssfw->pos += size;
		if (ssfw->pos > ssfw->fw->size || size == 0)
			break;

		ret = process_sigma_action(client, sa);


	while (1) {
		int ret = process_sigma_action(client, ssfw);
		pr_debug("%s: action returned %i\n", __func__, ret);
		pr_debug("%s: action returned %i\n", __func__, ret);
		if (ret == 1)

			return 0;
		if (ret <= 0)
		else if (ret)
			return ret;
			return ret;
	}
	}

	if (ssfw->pos != ssfw->fw->size)
		return -EINVAL;

	return 0;
}
}


int process_sigma_firmware(struct i2c_client *client, const char *name)
int process_sigma_firmware(struct i2c_client *client, const char *name)
@@ -89,16 +116,24 @@ int process_sigma_firmware(struct i2c_client *client, const char *name)


	/* then verify the header */
	/* then verify the header */
	ret = -EINVAL;
	ret = -EINVAL;
	if (fw->size < sizeof(*ssfw_head))

	/*
	 * Reject too small or unreasonable large files. The upper limit has been
	 * chosen a bit arbitrarily, but it should be enough for all practical
	 * purposes and having the limit makes it easier to avoid integer
	 * overflows later in the loading process.
	 */
	if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000)
		goto done;
		goto done;


	ssfw_head = (void *)fw->data;
	ssfw_head = (void *)fw->data;
	if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic)))
	if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic)))
		goto done;
		goto done;


	crc = crc32(0, fw->data, fw->size);
	crc = crc32(0, fw->data + sizeof(*ssfw_head),
			fw->size - sizeof(*ssfw_head));
	pr_debug("%s: crc=%x\n", __func__, crc);
	pr_debug("%s: crc=%x\n", __func__, crc);
	if (crc != ssfw_head->crc)
	if (crc != le32_to_cpu(ssfw_head->crc))
		goto done;
		goto done;


	ssfw.pos = sizeof(*ssfw_head);
	ssfw.pos = sizeof(*ssfw_head);
+4 −9
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@ struct sigma_firmware {
struct sigma_firmware_header {
struct sigma_firmware_header {
	unsigned char magic[7];
	unsigned char magic[7];
	u8 version;
	u8 version;
	u32 crc;
	__le32 crc;
};
};


enum {
enum {
@@ -40,19 +40,14 @@ enum {
struct sigma_action {
struct sigma_action {
	u8 instr;
	u8 instr;
	u8 len_hi;
	u8 len_hi;
	u16 len;
	__le16 len;
	u16 addr;
	__be16 addr;
	unsigned char payload[];
	unsigned char payload[];
};
};


static inline u32 sigma_action_len(struct sigma_action *sa)
static inline u32 sigma_action_len(struct sigma_action *sa)
{
{
	return (sa->len_hi << 16) | sa->len;
	return (sa->len_hi << 16) | le16_to_cpu(sa->len);
}

static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len)
{
	return sizeof(*sa) + payload_len + (payload_len % 2);
}
}


extern int process_sigma_firmware(struct i2c_client *client, const char *name);
extern int process_sigma_firmware(struct i2c_client *client, const char *name);
+0 −1
Original line number Original line Diff line number Diff line
@@ -2508,7 +2508,6 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
	SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
	SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
+3 −19
Original line number Original line Diff line number Diff line
@@ -4441,7 +4441,9 @@ static int stac92xx_init(struct hda_codec *codec)
		int pinctl, def_conf;
		int pinctl, def_conf;


		/* power on when no jack detection is available */
		/* power on when no jack detection is available */
		if (!spec->hp_detect) {
		/* or when the VREF is used for controlling LED */
		if (!spec->hp_detect ||
		    (spec->gpio_led > 8 && spec->gpio_led == nid)) {
			stac_toggle_power_map(codec, nid, 1);
			stac_toggle_power_map(codec, nid, 1);
			continue;
			continue;
		}
		}
@@ -5055,20 +5057,6 @@ static int stac92xx_pre_resume(struct hda_codec *codec)
	return 0;
	return 0;
}
}


static int stac92xx_post_suspend(struct hda_codec *codec)
{
	struct sigmatel_spec *spec = codec->spec;
	if (spec->gpio_led > 8) {
		/* with vref-out pin used for mute led control
		 * codec AFG is prevented from D3 state, but on
		 * system suspend it can (and should) be used
		 */
		snd_hda_codec_read(codec, codec->afg, 0,
				AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
	}
	return 0;
}

static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
				unsigned int power_state)
				unsigned int power_state)
{
{
@@ -5668,8 +5656,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
		} else {
		} else {
			codec->patch_ops.set_power_state =
			codec->patch_ops.set_power_state =
					stac92xx_set_power_state;
					stac92xx_set_power_state;
			codec->patch_ops.post_suspend =
					stac92xx_post_suspend;
		}
		}
		codec->patch_ops.pre_resume = stac92xx_pre_resume;
		codec->patch_ops.pre_resume = stac92xx_pre_resume;
		codec->patch_ops.check_power_status =
		codec->patch_ops.check_power_status =
@@ -5983,8 +5969,6 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
		} else {
		} else {
			codec->patch_ops.set_power_state =
			codec->patch_ops.set_power_state =
					stac92xx_set_power_state;
					stac92xx_set_power_state;
			codec->patch_ops.post_suspend =
					stac92xx_post_suspend;
		}
		}
		codec->patch_ops.pre_resume = stac92xx_pre_resume;
		codec->patch_ops.pre_resume = stac92xx_pre_resume;
		codec->patch_ops.check_power_status =
		codec->patch_ops.check_power_status =
+1 −20
Original line number Original line Diff line number Diff line
config SND_ATMEL_SOC
config SND_ATMEL_SOC
	tristate "SoC Audio for the Atmel System-on-Chip"
	tristate "SoC Audio for the Atmel System-on-Chip"
	depends on ARCH_AT91 || AVR32
	depends on ARCH_AT91
	help
	help
	  Say Y or M if you want to add support for codecs attached to
	  Say Y or M if you want to add support for codecs attached to
	  the ATMEL SSC interface. You will also need
	  the ATMEL SSC interface. You will also need
@@ -24,25 +24,6 @@ config SND_AT91_SOC_SAM9G20_WM8731
	  Say Y if you want to add support for SoC audio on WM8731-based
	  Say Y if you want to add support for SoC audio on WM8731-based
	  AT91sam9g20 evaluation board.
	  AT91sam9g20 evaluation board.


config SND_AT32_SOC_PLAYPAQ
        tristate "SoC Audio support for PlayPaq with WM8510"
        depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS
        select SND_ATMEL_SOC_SSC
        select SND_SOC_WM8510
        help
          Say Y or M here if you want to add support for SoC audio
          on the LRS PlayPaq.

config SND_AT32_SOC_PLAYPAQ_SLAVE
        bool "Run CODEC on PlayPaq in slave mode"
        depends on SND_AT32_SOC_PLAYPAQ
        default n
        help
          Say Y if you want to run with the AT32 SSC generating the BCLK
          and FRAME signals on the PlayPaq.  Unless you want to play
          with the AT32 as the SSC master, you probably want to say N here,
          as this will give you better sound quality.

config SND_AT91_SOC_AFEB9260
config SND_AT91_SOC_AFEB9260
	tristate "SoC Audio support for AFEB9260 board"
	tristate "SoC Audio support for AFEB9260 board"
	depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
	depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
Loading