code:
fix build with 3.0

Signed-off-by: Thomas Backlund <tmb@mageia.org>

 drivers/scsi/ppscsi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/ppscsi.c.orig	2011-07-15 02:37:27.000000000 +0300
+++ a/drivers/scsi/ppscsi.c	2011-07-15 13:44:29.514928985 +0300
@@ -72,7 +72,7 @@
 #define PPSC_DEF_NICE	0
 #define PPSC_INITIATOR  7

-spinlock_t      ppsc_spinlock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(ppsc_spinlock);

 static char	ppsc_bulk_map[256];

repo_name: ayhanyalcinsoy/main


code:
Fix for https://qa.mandriva.com/show_bug.cgi?id=45393

cmnd field of struct scsi_cmnd changed after commit "[SCSI] Let
scsi_cmnd->cmnd use request->cmd buffer"
(64a87b244b9297667ca80264aab849a36f494884)

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>

---
 drivers/scsi/ppscsi.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/scsi/ppscsi.c
+++ b/drivers/scsi/ppscsi.c
@@ -1009,7 +1009,6 @@ int ppsc_biosparam (struct scsi_device *
 static int ppsc_inquire (PHA *pha, int target, char *buf)
 {
 	char inq[6] = {0x12,0,0,0,36,0};
-	int i;
 	struct scsi_cmnd cmd;
 	struct scsi_device dev;

@@ -1017,7 +1016,7 @@ static int ppsc_inquire (PHA *pha, int t
 	dev.id = target;
 	cmd.device = &dev;
 	cmd.cmd_len = 6;
-	for (i=0;i<6;i++) cmd.cmnd[i] = inq[i];
+	cmd.cmnd = inq;
 	cmd.sdb.table.nents = 0;
 	cmd.sdb.table.sgl = (void *) buf;
 	cmd.sdb.length = 36;


code:
Update ppscsi for 2.6.24 changes.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com>

---
 drivers/scsi/ppscsi.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/scsi/ppscsi.c
+++ b/drivers/scsi/ppscsi.c
@@ -58,6 +58,7 @@
 #include <linux/spinlock.h>
 #include <linux/ioport.h>
 #include <linux/workqueue.h>
+#include <linux/scatterlist.h>

 #include <linux/parport.h>

@@ -484,7 +485,7 @@ static void ppsc_update_sg (PHA *pha)
 	if ((!pha->cur_len) && pha->sg_count) {
 		pha->sg_count--;
 		pha->sg_list++;
-		pha->cur_buf = page_address(pha->sg_list->page) + pha->sg_list->offset;
+		pha->cur_buf = sg_virt(pha->sg_list);
 		pha->cur_len = pha->sg_list->length;
 	}
 }
@@ -571,7 +572,7 @@ static void ppsc_engine (PHA *pha)
 					pha->sg_count--;
 					pha->sg_list =
 						(struct scatterlist *)pha->cur_cmd->request_buffer;
-					pha->cur_buf = page_address(pha->sg_list->page) + pha->sg_list->offset;
+					pha->cur_buf = sg_virt(pha->sg_list);
 					pha->cur_len = pha->sg_list->length;
 				} else {
 					pha->cur_buf = pha->cur_cmd->request_buffer;


code:
Update ppscsi for "[SCSI] implement scsi_data_buffer" change on Linux 2.6.25
(commit 30b0c37b27485a9cb897bfe3824f6f517b8c80d6)

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>

---
 drivers/scsi/ppscsi.c |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

--- a/drivers/scsi/ppscsi.c
+++ b/drivers/scsi/ppscsi.c
@@ -424,16 +424,16 @@ static void ppsc_start (PHA *pha)

 	bf &= (!((1<<pha->cur_cmd->device->id) & pha->slow_targets));

-	r = pha->cur_cmd->use_sg;
+	r = scsi_sg_count(pha->cur_cmd);
 	if (r) {
 		b = 0;
-		p = (struct scatterlist *)pha->cur_cmd->request_buffer;
+		p = scsi_sglist(pha->cur_cmd);
 		for (k=0;k<r;k++) {
 			b += p->length;
 			p++;
 		}
 	} else {
-		b = pha->cur_cmd->request_bufflen;
+		b = scsi_bufflen(pha->cur_cmd);
 	}

 	bf &= (b > 127);
@@ -567,16 +567,16 @@ static void ppsc_engine (PHA *pha)
 				pha->data_dir = phase & PPSC_IO;
 				pha->data_count = 0;

-				pha->sg_count = pha->cur_cmd->use_sg;
+				pha->sg_count = scsi_sg_count(pha->cur_cmd);
 				if (pha->sg_count) {
 					pha->sg_count--;
-					pha->sg_list =
-						(struct scatterlist *)pha->cur_cmd->request_buffer;
+					pha->sg_list = scsi_sglist(pha->cur_cmd);
 					pha->cur_buf = sg_virt(pha->sg_list);
 					pha->cur_len = pha->sg_list->length;
 				} else {
-					pha->cur_buf = pha->cur_cmd->request_buffer;
-					pha->cur_len = pha->cur_cmd->request_bufflen;
+					pha->cur_buf =
+						(char *)pha->cur_cmd->sdb.table.sgl;
+					pha->cur_len = scsi_bufflen(pha->cur_cmd);
 				}

 				pha->last_phase = phase;
@@ -622,7 +622,7 @@ static void ppsc_engine (PHA *pha)

 				if (pha->cur_cmd->cmnd[0] == REQUEST_SENSE) {

-					sb = (char *)pha->cur_cmd->request_buffer;
+					sb = (char *)pha->cur_cmd->sdb.table.sgl;
 					printk("%s: Sense key: %x ASC: %x ASCQ: %x\n",
 					       pha->device, sb[2] & 0xff,
 					       sb[12] & 0xff, sb[13] & 0xff);
@@ -819,9 +819,9 @@ static void ppsc_cleanup (PHA *pha)
 		cmd->cmnd[4] = sizeof(cmd->sense_buffer);
 		cmd->cmnd[5] = 0;
 		cmd->cmd_len = 6;
-		cmd->use_sg = 0;
-		cmd->request_buffer = (char *) cmd->sense_buffer;
-		cmd->request_bufflen = sizeof(cmd->sense_buffer);
+		cmd->sdb.table.nents = 0;
+		cmd->sdb.table.sgl = (void *) cmd->sense_buffer;
+		cmd->sdb.length = sizeof(cmd->sense_buffer);

 		pha->cur_cmd = cmd;
 		ppsc_do_claimed(pha,ppsc_start);
@@ -1018,9 +1018,9 @@ static int ppsc_inquire (PHA *pha, int t
 	cmd.device = &dev;
 	cmd.cmd_len = 6;
 	for (i=0;i<6;i++) cmd.cmnd[i] = inq[i];
-	cmd.use_sg = 0;
-	cmd.request_buffer = buf;
-	cmd.request_bufflen = 36;
+	cmd.sdb.table.nents = 0;
+	cmd.sdb.table.sgl = (void *) buf;
+	cmd.sdb.length = 36;

 	return ppsc_command(&cmd);
 }


code:
---
 drivers/scsi/Makefile  |    2 +-
 drivers/scsi/ppscsi.c  |   22 ++++++++++++----------
 drivers/scsi/ppscsi.h  |   34 ++++++++++++++++++----------------
 drivers/scsi/sparcsi.c |    6 +++---
 4 files changed, 34 insertions(+), 30 deletions(-)

--- a/drivers/scsi/ppscsi.c
+++ b/drivers/scsi/ppscsi.c
@@ -57,6 +57,7 @@
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/ioport.h>
+#include <linux/workqueue.h>

 #include <linux/parport.h>

@@ -95,7 +96,8 @@ static void ppsc_attach (struct parport
 		return;
 	}

-	add->port = parport_get_port (port);
+	atomic_inc(&port->ref_count);
+	add->port = port;
 	add->next = ppsc_port_list;
 	wmb ();
 	ppsc_port_list = add;
@@ -187,11 +189,11 @@ static void ppsc_set_intr (PHA *pha, voi
 	spin_unlock_irqrestore(&ppsc_spinlock,flags);
 }

-static void ppsc_tq_int (void *data)
+static void ppsc_tq_int (struct work_struct *work)
 {
 	void (*con)(PHA *);
 	unsigned long flags;
-	PHA *pha = (PHA *)data;
+	PHA *pha = container_of(work, PHA, wq);

 	spin_lock_irqsave(&ppsc_spinlock,flags);

@@ -377,7 +379,7 @@ int ppsc_command (struct scsi_cmnd *cmd)

 	ppsc_do_claimed(pha,ppsc_start);

-	while (pha->cur_cmd) scsi_sleep(1);
+	while (pha->cur_cmd) ssleep(1);

 	return cmd->result;
 }
@@ -886,7 +888,7 @@ static void ppsc_reset_pha (PHA *pha)
 	ppsc_claim(pha);
 	pha->proto->connect(pha);
 	pha->proto->reset_bus(pha);
-	scsi_sleep(4*HZ);
+	ssleep(4*HZ);
 	pha->proto->disconnect(pha);
 	ppsc_unclaim(pha);

@@ -905,7 +907,7 @@ int ppsc_reset (struct scsi_cmnd * cmd)
 		pha->abort_flag = PPSC_DO_RESET;

 	while (pha->cur_cmd && (k < PPSC_RESET_TMO)) {
-		scsi_sleep(HZ/10);
+		ssleep(HZ/10);
 		k += HZ/10;
 	}

@@ -992,11 +994,11 @@ int ppsc_biosparam (struct scsi_device *
 {
 	ip[0] = 0x40;
 	ip[1] = 0x20;
-	ip[2] = (capacity +1) / (ip[0] * ip[1]);
+	ip[2] = (unsigned int)(capacity +1) >> 11;
 	if (ip[2] > 1024) {
 		ip[0] = 0xff;
 		ip[1] = 0x3f;
-		ip[2] = (capacity +1) / (ip[0] * ip[1]);
+		ip[2] = (unsigned int)(capacity +1) / (0xff * 0x3f);
 		if (ip[2] > 1023)
 			ip[2] = 1023;
 	}
@@ -1084,7 +1086,7 @@ int ppsc_release_pha (PHA *pha)
 }

-int ppsc_detect (PSP *proto, Scsi_Host_Template *tpnt, int verbose)
+int ppsc_detect (PSP *proto, struct scsi_host_template *tpnt, int verbose)
 {
 	int i, m, p, d, n, s, z;
 	struct ppsc_port_list_struct *next_port = NULL; /* shut gcc up */
@@ -1146,7 +1148,7 @@ int ppsc_detect (PSP *proto, Scsi_Host_T
 		pha->device[p+1] = '0' + i;
 		pha->device[p+2] = 0;

-		INIT_WORK(&pha->wq, ppsc_tq_int, pha);
+		INIT_WORK(&pha->wq, ppsc_tq_int);

 		init_timer (&pha->timer);
 		pha->timer.data = (unsigned long) pha;
--- a/drivers/scsi/sparcsi.c
+++ b/drivers/scsi/sparcsi.c
@@ -165,7 +165,7 @@ static int sparcsi_test_proto (PHA *pha)

 		WR(1,0x80); udelay(60);
 		WR(1,0);
-		scsi_sleep(5*HZ);
+		ssleep(5*HZ);
 		pha->private[0] = 1;
 	}

@@ -363,14 +363,14 @@ static struct ppsc_protocol sparcsi_psp
 	sparcsi_reset_bus
 };

-int sparcsi_detect (Scsi_Host_Template *tpnt)
+int sparcsi_detect (struct scsi_host_template *tpnt)
 {
 	return ppsc_detect( &sparcsi_psp, tpnt, verbose);
 }

 #ifdef MODULE

-Scsi_Host_Template	driver_template = PPSC_TEMPLATE(sparcsi);
+struct scsi_host_template	driver_template = PPSC_TEMPLATE(sparcsi);

 #include "scsi_module.c"

--- a/drivers/scsi/ppscsi.h
+++ b/drivers/scsi/ppscsi.h
@@ -13,14 +13,16 @@
 #define	PPSC_H_VERSION	"0.92"

 #include <linux/module.h>
-#include <linux/config.h>
+#include <linux/version.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <asm/io.h>
 #include <linux/blkdev.h>

-#include "scsi.h"
-#include "hosts.h"
+#include <scsi/scsi.h>
+#include <scsi/scsi_host.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>

 /* ppscsi global functions */
@@ -40,31 +42,31 @@ extern int ppsc_release(struct Scsi_Host
 /* imports for hosts.c */

 #ifdef CONFIG_PPSCSI_T348
-extern int t348_detect( Scsi_Host_Template *);
+extern int t348_detect( struct scsi_host_template *);
 #endif

 #ifdef CONFIG_PPSCSI_T358
-extern int t358_detect( Scsi_Host_Template *);
+extern int t358_detect( struct scsi_host_template *);
 #endif

 #ifdef CONFIG_PPSCSI_ONSCSI
-extern int onscsi_detect( Scsi_Host_Template *);
+extern int onscsi_detect( struct scsi_host_template *);
 #endif

 #ifdef CONFIG_PPSCSI_EPST
-extern int epst_detect( Scsi_Host_Template *);
+extern int epst_detect( struct scsi_host_template *);
 #endif

 #ifdef CONFIG_PPSCSI_EPSA2
-extern int epsa2_detect( Scsi_Host_Template *);
+extern int epsa2_detect( struct scsi_host_template *);
 #endif

 #ifdef CONFIG_PPSCSI_VPI0
-extern int vpi0_detect( Scsi_Host_Template *);
+extern int vpi0_detect( struct scsi_host_template *);
 #endif

 #ifdef CONFIG_PPSCSI_SPARCSI
-extern int sparcsi_detect( Scsi_Host_Template *);
+extern int sparcsi_detect( struct scsi_host_template *);
 #endif

 #endif
@@ -303,7 +305,7 @@ struct ppsc_protocol {

 typedef struct ppsc_protocol PSP;

-extern int ppsc_detect( PSP *, Scsi_Host_Template *, int);
+extern int ppsc_detect( PSP *, struct scsi_host_template *, int);

 #ifdef PPSC_HA_MODULE

@@ -322,11 +324,11 @@ static STT stt[4] = { {"host0",8,host0},
 		      {"host3",8,host3} };
 #endif

-MODULE_PARM(host0,"1-8i");
-MODULE_PARM(host1,"1-8i");
-MODULE_PARM(host2,"1-8i");
-MODULE_PARM(host3,"1-8i");
-MODULE_PARM(verbose,"i");
+module_param_array(host0, int, NULL, 0);
+module_param_array(host1, int, NULL, 0);
+module_param_array(host2, int, NULL, 0);
+module_param_array(host3, int, NULL, 0);
+module_param(verbose, int, 0);

 static struct ppsc_host_adapter host_structs[4];

--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -136,7 +136,7 @@ obj-$(CONFIG_PPSCSI_ONSCSI)	+= onscsi.o
 obj-$(CONFIG_PPSCSI_EPSA2)	+= epsa2.o
 obj-$(CONFIG_PPSCSI_EPST)	+= epst.o
 obj-$(CONFIG_PPSCSI_VPI0)	+= vpi0.o
-obj-$(CONFIG_PPSCSI_VPI2)	+= vpi2.o
+obj-n				+= vpi2.o
 obj-$(CONFIG_PPSCSI_SPARCSI)	+= sparcsi.o

 obj-$(CONFIG_CHR_DEV_ST)	+= st.o


code:
#
# Mageia kernel series file
#
# This file describes the order in which patches should be applied
# in the kernel and why the patch is needed.
#
# Luiz Fernando N. Capitulino
# <lcapitulino@mandriva.com.br>

###
### Upstream git
###

###
### Stable Queue
###

###
### Arch x86
###

# laptop needing pci=assign-busses (#18989, needs to be submitted upstream)
x86-pci-toshiba-equium-a60-assign-busses.patch

# If users choose a bad video mode, allow to jump to
# a working one (TTL: forever)
x86-boot-video-80x25-if-break.patch

# Allow poweroff on UP machines running SMP kernels
x86-default_poweroff_up_machines.patch

# Fix #38760, need to be revised and submitted upstream
# BROKEN: x86-cpufreq-speedstep-dothan-3.patch

# raise vmalloc to fix https://bugs.mageia.org/show_bug.cgi?id=904
x86-increase-default-minimum-vmalloc-area-by-64MB-to-192MB.patch

# slows down boot
Revert-cpufreq-pcc-Enable-autoload-of-pcc-cpufreq-fo.patch

###
### Core
###
base-cacheinfo-silence-DT-warnings.patch

# fixes crash on boot on some Amd systems
iommu-amd-flush-IOTLB-for-specific-domains-only-v3.patch

###
### i2c
###

###
### PCI core
###

# BROKEN: pci-pciprobe-CardBusNo.patch

# http://lkml.org/lkml/2008/9/12/52
pci-add-ALI-M5229-ide-compatibility-mode-quirk.patch
pci-quirks-drop-devinit-exit.patch

# Stoney iommu hang
pci-Blacklist-AMD-Stoney-GPU-devices-for-ATS.patch

###
### PNP core
###

###
### ACPI
###

# CLEVO M360S acpi irq workaround
acpi-CLEVO-M360S-disable_acpi_irq.patch

# Clevo M720SR freezes with C3
acpi-processor-M720SR-limit-to-C2.patch

# backlight fixes
ACPI-video-Add-a-quirk-to-force-acpi-video-backlight.patch

# drop obsolete warn
acpi-do-not-warn-if-_BQC-does-not-exist.patch

# silence useless acpi warnings
acpi-ACPICA-Events-Fix-acpi_ev_initialize_region-return-v.patch

###
### Block
###

# epsa2 SCSI driver, don't know from where it came
scsi-ppscsi-2.6.2.patch

# epsa2 is far behind
scsi-ppscsi_fixes.patch

# Fix build of ppscsi on 2.6.24
scsi-ppscsi-sg-helper-update.patch

# Update/fix for ppscsi on 2.6.25
scsi-ppscsi-update-for-scsi_data_buffer.patch

# https://qa.mandriva.com/show_bug.cgi?id=45393
scsi-ppscsi-mdvbz45393.patch

# epsa2 3.0 buildfix
scsi-ppscsi-3.0-buildfix.patch

# Don't know know why this is needed
scsi-megaraid-new-sysfs-name.patch

# Looks like fixes from Arnaud, not sure why they're needed
ide-pci-sis5513-965.patch

mpt-vmware-fix.patch

# adds aliases to support upgrade from old dm-raid45 patch
dm-raid-aliases.patch

# disable floppy autoloading (mga #4696)
block-floppy-disable-pnp-modalias.patch

# prefer ata over ide drivers
ata-prefer-ata-drivers-over-ide-drivers-when-both-are-built.patch

# Nice SSD speedup
block-Make-CFQ-default-to-IOPS-mode-on-SSDs.patch

# Include new BFQ I/O scheduler
# (See http://algo.ing.unimo.it/people/paolo/disk_sched)
block-cgroups-kconfig-build-bits-for-BFQ-v7r11-4.5.0.patch
block-introduce-the-BFQ-v7r11-I-O-sched-for-4.5.0.patch
block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r11-for.patch
block-Turn-into-BFQ-v8r7-for-4.9.0.patch
block-update-bfq-from-v8r7-to-v8r10.patch
block-update-bfq-from-v8r10-to-v8r11.patch

# new macbooks
block-nvme-detect-NVMe-controller-in-recent-MacBooks.patch

###
### Char
###

# hard locks Dell R720xd
Revert-ipmi-Start-the-timer-and-thread-on-internal-m.patch

# tpm_crb fixes for SkyLake
char-tpm-tpm_crb-implement-tpm-crb-idle-state.patch
char-tmp-tpm_crb-fix-Intel-PTT-hw-bug-during-idle-state.patch
char-tpm-tpm_crb-open-code-the-crb_init-into-acpi_add.patch
char-tmp-tpm_crb-implement-runtime-pm-for-tpm_crb.patch

###
### File-system
###

# aufs from: http://aufs.sourceforge.net/ (mga#8314)
fs-aufs-4.9.patch
fs-aufs-4.9-modular.patch

# needed for mdadm: imsm: enable bad block support for imsm metadata
fs-seq_file-reset-iterator-to-first-record-for-zero-off.patch

# performance regression fix
fs-jbd2-Fix-dbench4-performance-regression-for-nobarrier-mounts.patch

###
### FireWire
###

# adding module aliases to ease upgrade from ieee1394
firewire-ieee1394-module-aliases.patch

###
### GPU/DRM
###

# new Q57 Host Bridge id
char-agp-intel-new-Q57-id.patch

# External mach64 drm support from git://anongit.freedesktop.org/git/mesa/drm
gpu-drm-mach64.patch
gpu-drm-mach64-fixes.patch
gpu-drm-mach64-2.6.31.patch
gpu-drm-mach64-fix-for-changed-drm_pci_alloc.patch
gpu-drm-mach64-fix-for-changed-drm_ioctl.patch
gpu-drm-mach64-2.6.36-buildfix.patch
gpu-drm-mach64-2.6.37-buildfix.patch
gpu-drm-mach64-3.0-buildfix.patch
gpu-drm-mach64-include-module.h.patch
gpu-drm-mach64-3.3-buildfix.patch
gpu-drm-mach64-3.6-buildfix.patch
gpu-drm-mach64-3.7-buildfix.patch
gpu-drm-mach64-3.12-buildfix.patch
gpu-drm-mach64-restore-mach64_PCI_IDS.patch
gpu-drm-mach64-linux-3.14-buildfix.patch
gpu-drm-mach64-3.17-buildfix.patch
gpu-drm-mach64-3.18-buildfix.patch

#
gpu-drm-i915-don-t-warn-about-Skylake-CPU-KabyPoint-PCH-.patch

# Amd polaris12 support
gpu-drm-amd-amdgpu-add-Polaris12-PCI-ID.patch
gpu-drm-amd-amdgpu-add-Polaris12-support-v3.patch
gpu-drm-amdgpu-powerplay-add-Polaris12-support.patch
gpu-drm-amd-amdgpu-add-POLARIS12-PCI-ID.patch
gpu-drm-amdgpu-add-Polaris12-DID.patch

# fix crash
gpu-drm-amdgpu-pm-check-for-headless-before-calling-comp.patch

###
### Hardware Monitoring
###

###
### Input
###

input-i8042-quirks-for-Fujitsu-Lifebook-A544-and-Lif.patch

###
### idle
###

###
### Kbuild
###

###
### Media
###

###
### Misc
###

###
### MM
###

###
### Network
###

# SiS 190 fixes
net-sis190-fix-list-usage.patch

# netfilter IFWLOG support
net-netfilter-IFWLOG.patch
net-netfilter-IFWLOG-mdv.patch
net-netfilter-IFWLOG-2.6.35-buildfix.patch
net-netfilter-IFWLOG-2.6.37-buildfix.patch
net-ipv4-netfilter-ipt_IFWLOG-3.6-buildfix.patch
net-netfilter-IFWLOG-3.7-buildfix.patch
net-netfilter-IFWLOG-remove-unused-label.patch

# netfilter psd support
net-netfilter-psd.patch
net-netfilter-psd-mdv.patch
net-netfilter-psd-2.6.35-buildfix.patch
net-netfilter-psd-fix-redefines.patch

# rtlwifi fixes
net-wireless-rtlwifi-Use-dev_kfree_skb_irq-instead-of-kfree_skb.patch
net-wireless-rtlwifi-Fix-kernel-oops-introduced-with-commit-e4965.patch

# update rtl8xxxu for mga#20508
net-wireless-realtek-rtl8xxxu-linux-4.11-rc.patch

###
### pinctrl
###

# fix non-booting Ryzen+ due to interrupt storm
pinctrl_amd-Use-regular-interrupt-instead-of-chained.patch

###
### Platform drivers
###

# Allow access to Shuttle WMI interface controls
# (Mainly allow turning on/off webcam and wireless on Shuttle DA18IE and DA18IM)
platform-x86-add-shuttle-wmi-driver.patch
platform-x86-shuttle-wmi-drop-devinit-exit.patch
platform-x86-shuttle-wmi-4.2-buildfix.patch

# X302UA no wifi
platform-x86-asus-nb-wmi-Add-wapf4-quirk-for-the-X30.patch

###
### RTC
###

###
### Serial
###

# Export pci_ids.h to user space, needed by ldetect
include-kbuild-export-pci_ids.patch

###
### Sound
###

# new codecs
sound-ALSA-hda-realtek-Add-new-codec-ID-ALC299.patch
sound-ALSA-hda-realtek-New-codec-support-of-ALC1220.patch
sound-ALSA-hda-realtek-new-id-for-alc1220.patch
sound-ALSA-hda-realtek-Remove-ALC285-device-ID.patch
sound-ALSA-hda-realtek-New-codecs-support-for-ALC215-ALC28.patch

# add support for Gigabyte GA-AX370 Gaming 5 with dual codecs (TTL: 4.12)
sound-ALSA-hda-A-new-flag-to-enforce-prefix-to-each-pin.patch
sound-ALSA-hda-Allow-to-enable-disable-vmaster-build-expli.patch
sound-ALSA-hda-Support-Gigabyte-Gaming-board-with-dual-Rea.patch
sound-ALSA-hda-Use-a-helper-function-for-renaming-kctl-nam.patch
# another dual codec system
sound-ALSA-hda-Apply-dual-codec-quirk-for-MSI-Z270-Gaming-.patch
sound-ALSA-hda-Fix-applying-MSI-dual-codec-mobo-quirk.patch

# intel
sound-ALSA-hda-Add-Geminilake-id-to-SKL_PLUS.patch
sound-ALSA-hda-Add-Coffelake-PCI-ID.patch
sound-ALSA-hda-Apply-quirks-to-Broxton-T-too.patch

###
### Staging
###

###
### TTY
###

###
###
###

###
### USB
###

hid-usbhid-IBM-BladeCenterHS20-quirk.patch

usb-storage-unusual_devs-add-id.patch
usb-storage-unusual_devs-add-id-2.6.37-buildfix.patch

###
### V4L
###

# pwc driver name in /proc/bus/devices, /sys fix and "advertisement" removal
media-usb-pwc-lie-in-proc-usb-devices.patch

###
### Video
###

# Mageia framebuffer boot logo
video-mageia-logo.patch

###
### 3rdparty
###

3rd-3rdparty-1.0-tree.patch

# TODO: fix up patch below to include all archs?
3rd-3rdparty-merge.patch

# acerhk
3rd-acerhk-0.5.35.patch
3rd-acerhk-kbuild.patch
3rd-acerhk-extra-cflags.patch
3rd-acerhk-proc_dir_entry-owner.patch
3rd-acerhk-fix-build-with-function-tracer.patch
3rd-acerhk-2.6.36-buildfix.patch
3rd-acerhk-fix-include.patch

# aes2501
3rd-aes2501-r19.patch
3rd-aes2501-kbuild.patch
3rd-aes2501-rmmod-oops-fix.patch

# ndiswrapper
3rd-ndiswrapper-1.60.patch
3rd-ndiswrapper-Kconfig.patch
3rd-ndiswrapper-Makefile-build-fix.patch
3rd-ndiswrapper-4.7-buildfix.patch

# rfswitch
3rd-rfswitch-1.3.patch
3rd-rfswitch-build-fix.patch
3rd-rfswitch-3.0-buildfix.patch

# viahss
3rd-viahss-0.92.patch
3rd-viahss-config.patch
3rd-viahss-module-license.patch
3rd-viahss-2.6.35-buildfix.patch
3rd-viahss-3.0-buildfix.patch

# add rtl8723bs support (mga#15874)
3rd-rtl8723bs.patch

# add rtl8812 support (mga#21043)
3rd-rtl8812au.patch

###
### Security
###

###
### Smack fixes
###

###
### XEN
###

###
### ARM
###

###
### IA64
###

###
### Tools
###

# wipe powerpc refrence so we can nuke dangling symlinks (mga#17676)
tools-testing-selftest-Makefile-remove-powerpc-reference.patch

# perf build fixes
tools-build-Make-fixdep-parsing-wait-for-last-target.patch
tools-perf-tools-Force-fixdep-compilation-at-the-start-of-.patch
tools-perf-tools-Move-perf-build-related-variables-under-n.patch

###
### UAPI
###


code:
From 9f3dadb156692e15933a4a97ef659f65151be4a1 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 10 Apr 2017 17:12:33 +0200
Subject: [PATCH 1/4] ALSA: hda - A new flag to enforce prefix to each pin

This is a preliminary patch for a smooth multi-codec support, and it
introduces a new flag, force_pin_prefix, to struct hda_codec.
This flag is used to force to add the pin location prefix to each
input pin.  For example, when there is only one microphone pin,
usually the auto-parser assigns the string "Mic".  With this flag on,
it'll be like "Front Mic".  Also, the creation of "Master" or "PCM"
playback volume for a single pin is suppressed, too.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195305
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_auto_parser.c | 1 +
 sound/pci/hda/hda_codec.h       | 1 +
 sound/pci/hda/hda_generic.c     | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index a03cf68..d3ea731 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -580,6 +580,7 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec,
 		has_multiple_pins = 1;
 	if (has_multiple_pins && type == AUTO_PIN_MIC)
 		has_multiple_pins &= check_mic_location_need(codec, cfg, input);
+	has_multiple_pins |= codec->force_pin_prefix;
 	return hda_get_input_pin_label(codec, &cfg->inputs[input],
 				       cfg->inputs[input].pin,
 				       has_multiple_pins);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index f17f252..d6fb2d5 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -256,6 +256,7 @@ struct hda_codec {
 	unsigned int dump_coef:1; /* dump processing coefs in codec proc file */
 	unsigned int power_save_node:1; /* advanced PM for each widget */
 	unsigned int auto_runtime_pm:1; /* enable automatic codec runtime pm */
+	unsigned int force_pin_prefix:1; /* Add location prefix */
 #ifdef CONFIG_PM
 	unsigned long power_on_acct;
 	unsigned long power_off_acct;
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index e7c8f4f..4438328 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -1125,6 +1125,7 @@ static const char *get_line_out_pfx(struct hda_codec *codec, int ch,

 	*index = 0;
 	if (cfg->line_outs == 1 && !spec->multi_ios &&
+	    !codec->force_pin_prefix &&
 	    !cfg->hp_outs && !cfg->speaker_outs)
 		return spec->vmaster_mute.hook ? "PCM" : "Master";

@@ -1132,6 +1133,7 @@ static const char *get_line_out_pfx(struct hda_codec *codec, int ch,
 	 * use it master (or "PCM" if a vmaster hook is present)
 	 */
 	if (spec->multiout.num_dacs == 1 && !spec->mixer_nid &&
+	    !codec->force_pin_prefix &&
 	    !spec->multiout.hp_out_nid[0] && !spec->multiout.extra_out_nid[0])
 		return spec->vmaster_mute.hook ? "PCM" : "Master";

--
2.10.2


code:
From e79b0006c45c9b0b22f3ea54ff6e256b34c1f208 Mon Sep 17 00:00:00 2001
From: Megha Dey <megha.dey@intel.com>
Date: Wed, 14 Jun 2017 09:51:56 +0530
Subject: [PATCH] ALSA: hda - Add Coffelake PCI ID

Coffelake is another Intel part, so need to add PCI ID for it.

Signed-off-by: Megha Dey <megha.dey@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_intel.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1770f085c2a6..e3c696c46a21 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -371,9 +371,10 @@ enum {
 #define IS_KBL_H(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa2f0)
 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
 #define IS_GLK(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x3198)
+#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
 #define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) || \
 			IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci)	|| \
-			IS_GLK(pci)
+			IS_GLK(pci) || IS_CFL(pci)

 static char *driver_short_names[] = {
 	[AZX_DRIVER_ICH] = "HDA Intel",
@@ -2378,6 +2379,9 @@ static const struct pci_device_id azx_ids[] = {
 	/* Kabylake-H */
 	{ PCI_DEVICE(0x8086, 0xa2f0),
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE },
+	/* Coffelake */
+	{ PCI_DEVICE(0x8086, 0xa348),
+	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE},
 	/* Broxton-P(Apollolake) */
 	{ PCI_DEVICE(0x8086, 0x5a98),
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_BROXTON },
--
2.13.1


code:
From 12ee4022f67f8854061b46e5c0a7ad6258ab66c2 Mon Sep 17 00:00:00 2001
From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Date: Wed, 12 Apr 2017 09:54:00 +0530
Subject: [PATCH] ALSA: hda: Add Geminilake id to SKL_PLUS

Geminilake is Skylake family platform. So add it's id to skl_plus check.

Fixes: 126cfa2f5e15 ("ALSA: hda: Add Geminilake HDMI codec ID")
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Cc: Senthilnathan Veppur <senthilnathanx.veppur@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_intel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 59ab34fa0bc8..b786fbab029f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -370,8 +370,10 @@ enum {
 #define IS_KBL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d71)
 #define IS_KBL_H(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa2f0)
 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
+#define IS_GLK(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x3198)
 #define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) || \
-			IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci)
+			IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci)	|| \
+			IS_GLK(pci)

 static char *driver_short_names[] = {
 	[AZX_DRIVER_ICH] = "HDA Intel",
--
2.13.1


code:
From 7480316c265c9fcdbf73b1b8dec061b893b7e987 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 10 Apr 2017 17:37:34 +0200
Subject: [PATCH 2/4] ALSA: hda - Allow to enable/disable vmaster build
 explicitly

Another preliminary patch for the dual-codec support: since the
support of vmaster over multiple codecs is difficult, simply disable
it by a new flag to hda_codec struct.  A new user hint is added as
well for consistency.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 Documentation/sound/hd-audio/notes.rst | 2 ++
 sound/pci/hda/hda_generic.c            | 7 +++++--
 sound/pci/hda/hda_generic.h            | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

#diff --git a/Documentation/sound/hd-audio/notes.rst b/Documentation/sound/hd-audio/notes.rst
#index 9eeb9b4..f59c3cd 100644
#--- a/Documentation/sound/hd-audio/notes.rst
#+++ b/Documentation/sound/hd-audio/notes.rst
#@@ -494,6 +494,8 @@ add_hp_mic (bool)
# hp_mic_detect (bool)
#     enable/disable the hp/mic shared input for a single built-in mic
#     case; default true
#+vmaster (bool)
#+    enable/disable the virtual Master control; default true
# mixer_nid (int)
#     specifies the widget NID of the analog-loopback mixer
#
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 4438328..2842c82 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -196,6 +196,9 @@ static void parse_user_hints(struct hda_codec *codec)
 	val = snd_hda_get_bool_hint(codec, "hp_mic_detect");
 	if (val >= 0)
 		spec->suppress_hp_mic_detect = !val;
+	val = snd_hda_get_bool_hint(codec, "vmaster");
+	if (val >= 0)
+		spec->suppress_vmaster = !val;

 	if (!snd_hda_get_int_hint(codec, "mixer_nid", &val))
 		spec->mixer_nid = val;
@@ -5033,7 +5036,7 @@ int snd_hda_gen_build_controls(struct hda_codec *codec)
 	}

 	/* if we have no master control, let's create it */
-	if (!spec->no_analog &&
+	if (!spec->no_analog && !spec->suppress_vmaster &&
 	    !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
 		err = snd_hda_add_vmaster(codec, "Master Playback Volume",
 					  spec->vmaster_tlv, slave_pfxs,
@@ -5041,7 +5044,7 @@ int snd_hda_gen_build_controls(struct hda_codec *codec)
 		if (err < 0)
 			return err;
 	}
-	if (!spec->no_analog &&
+	if (!spec->no_analog && !spec->suppress_vmaster &&
 	    !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
 		err = __snd_hda_add_vmaster(codec, "Master Playback Switch",
 					    NULL, slave_pfxs,
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index f66fc7e..6177231 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -229,6 +229,7 @@ struct hda_gen_spec {
 	unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */
 	unsigned int power_down_unused:1; /* power down unused widgets */
 	unsigned int dac_min_mute:1; /* minimal = mute for DACs */
+	unsigned int suppress_vmaster:1; /* don't create vmaster kctls */

 	/* other internal flags */
 	unsigned int no_analog:1; /* digital I/O only */
--
2.10.2


code:
From 63691587f7b0028326ddd1226c378aaaeca4d4e4 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 22 May 2017 16:32:46 +0200
Subject: [PATCH] ALSA: hda - Apply dual-codec quirk for MSI Z270-Gaming mobo

MSI Z270-Gamin mobo has also two ALC1220 codecs like Gigabyte AZ370-
Gaming mobo.  Apply the same quirk to this one.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9c22ad694534..3fdd5af190a4 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2328,6 +2328,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
+	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
--
2.13.1


code:
From c7ecb9068e6772c43941ce609f08bc53f36e1dce Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 14 Jun 2017 07:37:14 +0200
Subject: [PATCH] ALSA: hda - Apply quirks to Broxton-T, too

Broxton-T was a forgotten child and we didn't apply the quirks for
Skylake+ properly.  Meanwhile, a quirk for reducing the DMA latency
seems specific to the early Broxton model, so we leave as is.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_intel.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e3c696c46a21..01eb1dc7b5b3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -370,11 +370,12 @@ enum {
 #define IS_KBL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d71)
 #define IS_KBL_H(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa2f0)
 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
+#define IS_BXT_T(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x1a98)
 #define IS_GLK(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x3198)
 #define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348)
-#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) || \
-			IS_KBL(pci) || IS_KBL_LP(pci) || IS_KBL_H(pci)	|| \
-			IS_GLK(pci) || IS_CFL(pci)
+#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci) || \
+			  IS_BXT_T(pci) || IS_KBL(pci) || IS_KBL_LP(pci) || \
+			  IS_KBL_H(pci)	|| IS_GLK(pci) || IS_CFL(pci))

 static char *driver_short_names[] = {
 	[AZX_DRIVER_ICH] = "HDA Intel",
--
2.13.1


code:
From d2c3b14e1f0dcebdb695617c0c1342a36b914a47 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 1 Jun 2017 09:35:30 +0200
Subject: [PATCH] ALSA: hda - Fix applying MSI dual-codec mobo quirk

The previous commit [63691587f7b0: ALSA: hda - Apply dual-codec quirk
for MSI Z270-Gaming mobo] attempted to apply the existing dual-codec
quirk for a MSI mobo.  But it turned out that this isn't applied
properly due to the MSI-vendor quirk before this entry.  I overlooked
such two MSI entries just because they were put in the wrong position,
although we have a list ordered by PCI SSID numbers.

This patch fixes it by rearranging the unordered entries.

Fixes: 63691587f7b0 ("ALSA: hda - Apply dual-codec quirk for MSI Z270-Gaming mobo")
Reported-by: Rudolf Schmidt <info@rudolfschmidt.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 918e45268915..a57988d617e9 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2324,11 +2324,11 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),

 	SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
-	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
-	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
 	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
+	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
 	SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
+	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
--
2.13.1


code:
From 7beb3a6e9335d13872f24566b451f8371edd238f Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 10 Apr 2017 18:05:52 +0200
Subject: [PATCH 3/4] ALSA: hda - Support Gigabyte Gaming board with dual
 Realtek codecs

This patch adds some workarounds to make Gigabyte GA-AX370 Gaming 5
board working without the conflicts of kctls, etc.  In general, the
dual codec configs result in the conflicts of the following stuff:
- Master controls
- Capture controls
- Analog loopback controls
In addition, the auto-mute and the auto-mic can't work well among
multiple codecs.

The current "solution" is to disable all these features, and use UCM
for a better PulseAudio management.  For a dedicated UCM profile, the
patch overrides the card longname so that the system an get a unique
profile path.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195305
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 61 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9371f1a..e81cf83 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1800,6 +1800,7 @@ enum {
 	ALC882_FIXUP_NO_PRIMARY_HP,
 	ALC887_FIXUP_ASUS_BASS,
 	ALC887_FIXUP_BASS_CHMAP,
+	ALC1220_FIXUP_GB_DUAL_CODECS,
 };

 static void alc889_fixup_coef(struct hda_codec *codec,
@@ -1962,6 +1963,61 @@ static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
 static void alc_fixup_bass_chmap(struct hda_codec *codec,
 				 const struct hda_fixup *fix, int action);

+/* For dual-codec configuration, we need to disable some features to avoid
+ * conflicts of kctls and PCM streams
+ */
+static void alc_fixup_dual_codecs(struct hda_codec *codec,
+				  const struct hda_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+
+	if (action != HDA_FIXUP_ACT_PRE_PROBE)
+		return;
+	/* disable vmaster */
+	spec->gen.suppress_vmaster = 1;
+	/* auto-mute and auto-mic switch don't work with multiple codecs */
+	spec->gen.suppress_auto_mute = 1;
+	spec->gen.suppress_auto_mic = 1;
+	/* disable aamix as well */
+	spec->gen.mixer_nid = 0;
+	/* add location prefix to avoid conflicts */
+	codec->force_pin_prefix = 1;
+}
+
+static void rename_ctl(struct hda_codec *codec, const char *oldname,
+		       const char *newname)
+{
+	struct snd_kcontrol *kctl;
+
+	kctl = snd_hda_find_mixer_ctl(codec, oldname);
+	if (kctl)
+		strcpy(kctl->id.name, newname);
+}
+
+static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
+					 const struct hda_fixup *fix,
+					 int action)
+{
+	alc_fixup_dual_codecs(codec, fix, action);
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		/* override card longname to provide a unique UCM profile */
+		strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
+		break;
+	case HDA_FIXUP_ACT_BUILD:
+		/* rename Capture controls depending on the codec */
+		rename_ctl(codec, "Capture Volume",
+			   codec->addr == 0 ?
+			   "Rear-Panel Capture Volume" :
+			   "Front-Panel Capture Volume");
+		rename_ctl(codec, "Capture Switch",
+			   codec->addr == 0 ?
+			   "Rear-Panel Capture Switch" :
+			   "Front-Panel Capture Switch");
+		break;
+	}
+}
+
 static const struct hda_fixup alc882_fixups[] = {
 	[ALC882_FIXUP_ABIT_AW9D_MAX] = {
 		.type = HDA_FIXUP_PINS,
@@ -2198,6 +2254,10 @@ static const struct hda_fixup alc882_fixups[] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc_fixup_bass_chmap,
 	},
+	[ALC1220_FIXUP_GB_DUAL_CODECS] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc1220_fixup_gb_dual_codecs,
+	},
 };

 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2267,6 +2327,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
 	SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
+	SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
 	SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
 	SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
--
2.10.2


code:
From 56798e6b3a2264b58d50b93cfd66586ede77d661 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 11 Apr 2017 08:10:52 +0200
Subject: [PATCH 4/4] ALSA: hda - Use a helper function for renaming kctl names

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e81cf83..57eeefd 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4724,7 +4724,6 @@ static void alc282_fixup_asus_tx300(struct hda_codec *codec,
 		{ 0x1b, 0x21114000 }, /* dock speaker pin */
 		{}
 	};
-	struct snd_kcontrol *kctl;

 	switch (action) {
 	case HDA_FIXUP_ACT_PRE_PROBE:
@@ -4739,12 +4738,10 @@ static void alc282_fixup_asus_tx300(struct hda_codec *codec,
 		/* this is a bit tricky; give more sane names for the main
 		 * (tablet) speaker and the dock speaker, respectively
 		 */
-		kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
-		if (kctl)
-			strcpy(kctl->id.name, "Dock Speaker Playback Switch");
-		kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
-		if (kctl)
-			strcpy(kctl->id.name, "Speaker Playback Switch");
+		rename_ctl(codec, "Speaker Playback Switch",
+			   "Dock Speaker Playback Switch");
+		rename_ctl(codec, "Bass Speaker Playback Switch",
+			   "Speaker Playback Switch");
 		break;
 	}
 }
--
2.10.2


code:
From 28f1f9b26cee161ddd3985b3eb78e3ffada08dda Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Wed, 4 Jan 2017 14:49:07 +0800
Subject: [PATCH] ALSA: hda/realtek - Add new codec ID ALC299

ALC299 was similar as ALC225.
Add headset support for ALC299.
ALC3271 was for Dell rename.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 1ae29fd..3c69647 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -337,6 +337,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
 	case 0x10ec0288:
 	case 0x10ec0295:
 	case 0x10ec0298:
+	case 0x10ec0299:
 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
 		break;
 	case 0x10ec0285:
@@ -912,6 +913,7 @@ static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
 	{ 0x10ec0256, 0x1028, 0, "ALC3246" },
 	{ 0x10ec0225, 0x1028, 0, "ALC3253" },
 	{ 0x10ec0295, 0x1028, 0, "ALC3254" },
+	{ 0x10ec0299, 0x1028, 0, "ALC3271" },
 	{ 0x10ec0670, 0x1025, 0, "ALC669X" },
 	{ 0x10ec0676, 0x1025, 0, "ALC679X" },
 	{ 0x10ec0282, 0x1043, 0, "ALC3229" },
@@ -3716,6 +3718,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
 		break;
 	case 0x10ec0225:
 	case 0x10ec0295:
+	case 0x10ec0299:
 		alc_process_coef_fw(codec, coef0225);
 		break;
 	case 0x10ec0867:
@@ -3823,6 +3826,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
 		break;
 	case 0x10ec0225:
 	case 0x10ec0295:
+	case 0x10ec0299:
 		alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
 		snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
 		alc_process_coef_fw(codec, coef0225);
@@ -3881,6 +3885,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)
 	switch (codec->core.vendor_id) {
 	case 0x10ec0225:
 	case 0x10ec0295:
+	case 0x10ec0299:
 		alc_process_coef_fw(codec, coef0225);
 		break;
 	case 0x10ec0255:
@@ -3996,6 +4001,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
 		break;
 	case 0x10ec0225:
 	case 0x10ec0295:
+	case 0x10ec0299:
 		alc_process_coef_fw(codec, coef0225);
 		break;
 	case 0x10ec0867:
@@ -4089,6 +4095,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
 		break;
 	case 0x10ec0225:
 	case 0x10ec0295:
+	case 0x10ec0299:
 		alc_process_coef_fw(codec, coef0225);
 		break;
 	}
@@ -4173,6 +4180,7 @@ static void alc_determine_headset_type(struct hda_codec *codec)
 		break;
 	case 0x10ec0225:
 	case 0x10ec0295:
+	case 0x10ec0299:
 		alc_process_coef_fw(codec, coef0225);
 		msleep(800);
 		val = alc_read_coef_idx(codec, 0x46);
@@ -6219,6 +6227,7 @@ static int patch_alc269(struct hda_codec *codec)
 		break;
 	case 0x10ec0225:
 	case 0x10ec0295:
+	case 0x10ec0299:
 		spec->codec_variant = ALC269_TYPE_ALC225;
 		break;
 	case 0x10ec0234:
@@ -7256,6 +7265,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
 	HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
+	HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
 	HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
 	HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
 	HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
--
2.10.2


code:
From a535ad57d0e6b959cd79914a1127caade36a9459 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Mon, 16 Jan 2017 16:59:26 +0800
Subject: [PATCH] ALSA: hda/realtek - New codec support of ALC1220

Add support for new codec of ALC1220.
It's compatible with ALC882 & co.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 3c69647..1c88da8 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -380,6 +380,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
 		break;
 	case 0x10ec0899:
 	case 0x10ec0900:
+	case 0x10ec1220:
 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
 		break;
 	}
@@ -2310,6 +2311,7 @@ static int patch_alc882(struct hda_codec *codec)
 	case 0x10ec0882:
 	case 0x10ec0885:
 	case 0x10ec0900:
+	case 0x10ec1220:
 		break;
 	default:
 		/* ALC883 and variants */
@@ -7297,6 +7299,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
+	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
 	{} /* terminator */
 };
 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
--
2.10.2


code:
From 0a6f0600efc3df0179a33188c30b5026bd9d1c27 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Fri, 30 Jun 2017 16:00:48 +0800
Subject: [PATCH] ALSA: hda/realtek - New codecs support for
 ALC215/ALC285/ALC289

Add new codecs support for ALC215 ALC285 ALC289.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 80c7c832d442..c39bc497650c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -327,6 +327,7 @@ static void alc_fill_eapd_coef(struct hd
 	case 0x10ec0292:
 		alc_update_coef_idx(codec, 0x4, 1<<15, 0);
 		break;
+	case 0x10ec0215:
 	case 0x10ec0225:
 	case 0x10ec0233:
 	case 0x10ec0255:
@@ -335,8 +336,10 @@ static void alc_fill_eapd_coef(struct hd
 	case 0x10ec0283:
 	case 0x10ec0286:
 	case 0x10ec0288:
+	case 0x10ec0285:
 	case 0x10ec0295:
 	case 0x10ec0298:
+	case 0x10ec0289:
 	case 0x10ec0299:
 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
 		break;
@@ -2723,6 +2726,7 @@ enum {
 	ALC269_TYPE_ALC298,
 	ALC269_TYPE_ALC255,
 	ALC269_TYPE_ALC256,
+	ALC269_TYPE_ALC215,
 	ALC269_TYPE_ALC225,
 	ALC269_TYPE_ALC294,
 	ALC269_TYPE_ALC700,
@@ -2755,6 +2759,7 @@ static int alc269_parse_auto_config(stru
 	case ALC269_TYPE_ALC298:
 	case ALC269_TYPE_ALC255:
 	case ALC269_TYPE_ALC256:
+	case ALC269_TYPE_ALC215:
 	case ALC269_TYPE_ALC225:
 	case ALC269_TYPE_ALC294:
 	case ALC269_TYPE_ALC700:
@@ -6298,6 +6303,12 @@ static int patch_alc269(struct hda_codec
 		spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
 		alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
 		break;
+	case 0x10ec0215:
+	case 0x10ec0285:
+	case 0x10ec0289:
+		spec->codec_variant = ALC269_TYPE_ALC215;
+		spec->gen.mixer_nid = 0;
+		break;
 	case 0x10ec0225:
 	case 0x10ec0295:
 	case 0x10ec0299:
@@ -7267,6 +7278,7 @@ static int patch_alc680(struct hda_codec
  * patch entries
  */
 static const struct hda_device_id snd_hda_id_realtek[] = {
+	HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
@@ -7289,8 +7301,10 @@ static const struct hda_device_id snd_hd
 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
+	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
+	HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),


code:
From 4731d5de4b1ca8d2565782cc3aeac392db07c075 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Fri, 30 Jun 2017 15:22:57 +0800
Subject: [PATCH] ALSA: hda/realtek - Remove ALC285 device ID

0x0285 Device ID was not used.
It just assigned for alias of ALC293 as backup.
So, remove it first.
Because our new codec will use this device ID.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c79491a1cd47..80c7c832d442 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -340,7 +340,6 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
 	case 0x10ec0299:
 		alc_update_coef_idx(codec, 0x10, 1<<9, 0);
 		break;
-	case 0x10ec0285:
 	case 0x10ec0293:
 		alc_update_coef_idx(codec, 0xa, 1<<13, 0);
 		break;
@@ -2738,7 +2737,7 @@ enum {
 	ALC269_TYPE_ALC282,
 	ALC269_TYPE_ALC283,
 	ALC269_TYPE_ALC284,
-	ALC269_TYPE_ALC285,
+	ALC269_TYPE_ALC293,
 	ALC269_TYPE_ALC286,
 	ALC269_TYPE_ALC298,
 	ALC269_TYPE_ALC255,
@@ -2764,7 +2763,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
 	case ALC269_TYPE_ALC269VC:
 	case ALC269_TYPE_ALC280:
 	case ALC269_TYPE_ALC284:
-	case ALC269_TYPE_ALC285:
+	case ALC269_TYPE_ALC293:
 		ssids = alc269va_ssids;
 		break;
 	case ALC269_TYPE_ALC269VB:
@@ -6678,9 +6677,8 @@ static int patch_alc269(struct hda_codec *codec)
 	case 0x10ec0292:
 		spec->codec_variant = ALC269_TYPE_ALC284;
 		break;
-	case 0x10ec0285:
 	case 0x10ec0293:
-		spec->codec_variant = ALC269_TYPE_ALC285;
+		spec->codec_variant = ALC269_TYPE_ALC293;
 		break;
 	case 0x10ec0286:
 	case 0x10ec0288:
@@ -7752,7 +7750,6 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
 	HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
-	HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
 	HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
--
2.13.2


code:
From a7498943b45d43f4a1abf37b75908c1edf840230 Mon Sep 17 00:00:00 2001
From: Kailang Yang <kailang@realtek.com>
Date: Tue, 11 Jul 2017 15:15:47 +0800
Subject: [PATCH] ALSA: hda/realtek - New codec device ID for ALC1220

Codec ID is 0x1168.
It is another ALC1220 codec.

Signed-off-by: Kailang Yang <kailang@realtek.com>

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e2116d2..45d58fc 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -380,6 +380,7 @@ static void alc_fill_eapd_coef(struct hd
 		break;
 	case 0x10ec0899:
 	case 0x10ec0900:
+	case 0x10ec1168:
 	case 0x10ec1220:
 		alc_update_coef_idx(codec, 0x7, 1<<1, 0);
 		break;
@@ -7331,6 +7332,7 @@ static const struct hda_device_id snd_hd
 	HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
 	HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
 	HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
+	HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
 	HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
 	{} /* terminator */
 };


code:
From 1cd6472e3f8d3fdee0fd19f7088807b284d3080f Mon Sep 17 00:00:00 2001
From: Jiri Olsa <jolsa@redhat.com>
Date: Thu, 1 Dec 2016 14:00:25 +0100
Subject: [PATCH] tools build: Make fixdep parsing wait for last target

The fixdep tool, among other things, replaces the target of the object
in the gcc generated dependency output file.

The parsing code assumes there's only single target in the rule but this
is not always the case as described in here:

  https://gcc.gnu.org/ml/gcc-help/2016-11/msg00099.html

Make the fixdep code smart enough to skip all the possible targets.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Peter Foley <pefoley2@pefoley.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20161201130025.GA16430@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/fixdep.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/build/fixdep.c b/tools/build/fixdep.c
index 1521d36..734d154 100644
--- a/tools/build/fixdep.c
+++ b/tools/build/fixdep.c
@@ -49,7 +49,7 @@ static void parse_dep_file(void *map, size_t len)
 	char *end = m + len;
 	char *p;
 	char s[PATH_MAX];
-	int is_target;
+	int is_target, has_target = 0;
 	int saw_any_target = 0;
 	int is_first_dep = 0;

@@ -67,7 +67,8 @@ static void parse_dep_file(void *map, size_t len)
 		if (is_target) {
 			/* The /next/ file is the first dependency */
 			is_first_dep = 1;
-		} else {
+			has_target = 1;
+		} else if (has_target) {
 			/* Save this token/filename */
 			memcpy(s, m, p-m);
 			s[p - m] = 0;
--
2.10.2


code:
From abb26210a39522a6645bce3f438ed9a26bedb11b Mon Sep 17 00:00:00 2001
From: Jiri Olsa <jolsa@kernel.org>
Date: Tue, 6 Dec 2016 14:18:49 +0100
Subject: [PATCH] perf tools: Force fixdep compilation at the start of the
 build

The fixdep tool needs to be built before everything else, because it fixes
every object dependency file.

We handle this currently by making all objects to depend on fixdep, which is
error prone and is easily forgotten when new object is added.

Instead of this, this patch force fixdep tool to be built as the first target
in the separate make session. This way we don't need to handle extra fixdep
dependencies and we are certain there's no fixdep race with any parallel make
job.

Committer notes:

Testing it:

Before:

  $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
  make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD:   Doing 'make -j4' parallel build

  Auto-detecting system features:
  ...                         dwarf: [ on  ]
  ...            dwarf_getlocations: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...        numa_num_possible_cpus: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libcrypto: [ on  ]
  ...                     libunwind: [ on  ]
  ...            libdw-dwarf-unwind: [ on  ]
  ...                          zlib: [ on  ]
  ...                          lzma: [ on  ]
  ...                     get_cpuid: [ on  ]
  ...                           bpf: [ on  ]

    GEN      /tmp/build/perf/common-cmds.h
    HOSTCC   /tmp/build/perf/fixdep.o
    HOSTLD   /tmp/build/perf/fixdep-in.o
    LINK     /tmp/build/perf/fixdep
    MKDIR    /tmp/build/perf/pmu-events/
    HOSTCC   /tmp/build/perf/pmu-events/json.o
    MKDIR    /tmp/build/perf/pmu-events/
    HOSTCC   /tmp/build/perf/pmu-events/jsmn.o
    HOSTCC   /tmp/build/perf/pmu-events/jevents.o
    HOSTLD   /tmp/build/perf/pmu-events/jevents-in.o
    PERF_VERSION = 4.9.rc8.g868cd5
    CC       /tmp/build/perf/perf-read-vdso32
  <SNIP>

After:

  $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
  make: Entering directory '/home/acme/git/linux/tools/perf'
    BUILD:   Doing 'make -j4' parallel build
    HOSTCC   /tmp/build/perf/fixdep.o
    HOSTLD   /tmp/build/perf/fixdep-in.o
    LINK     /tmp/build/perf/fixdep

  Auto-detecting system features:
  ...                         dwarf: [ on  ]
  ...            dwarf_getlocations: [ on  ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ on  ]
  ...                      libaudit: [ on  ]
  ...                        libbfd: [ on  ]
  ...                        libelf: [ on  ]
  ...                       libnuma: [ on  ]
  ...        numa_num_possible_cpus: [ on  ]
  ...                       libperl: [ on  ]
  ...                     libpython: [ on  ]
  ...                      libslang: [ on  ]
  ...                     libcrypto: [ on  ]
  ...                     libunwind: [ on  ]
  ...            libdw-dwarf-unwind: [ on  ]
  ...                          zlib: [ on  ]
  ...                          lzma: [ on  ]
  ...                     get_cpuid: [ on  ]
  ...                           bpf: [ on  ]

    GEN      /tmp/build/perf/common-cmds.h
    MKDIR    /tmp/build/perf/fd/
    CC       /tmp/build/perf/fd/array.o
    LD       /tmp/build/perf/fd/libapi-in.o
    MKDIR    /tmp/build/perf/fs/
    CC       /tmp/build/perf/event-parse.o
    CC       /tmp/build/perf/fs/fs.o
    PERF_VERSION = 4.9.rc8.g57a92f
    CC       /tmp/build/perf/event-plugin.o
    MKDIR    /tmp/build/perf/fs/
    CC       /tmp/build/perf/fs/tracing_path.o
  <SNIP>

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481030331-31944-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf | 50 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 38 insertions(+), 12 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9e5a6e1..33b1d9f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -177,6 +177,35 @@ ifeq ($(filter-out $(NON_CONFIG_TARGETS)
 endif
 endif

+# The fixdep build - we force fixdep tool to be built as
+# the first target in the separate make session not to be
+# disturbed by any parallel make jobs. Once fixdep is done
+# we issue the requested build with FIXDEP=1 variable.
+#
+# The fixdep build is disabled for $(NON_CONFIG_TARGETS)
+# targets, because it's not necessary.
+
+ifdef FIXDEP
+  force_fixdep := 0
+else
+  force_fixdep := $(config)
+endif
+
+export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK
+export HOSTCC HOSTLD HOSTAR
+
+include $(srctree)/tools/build/Makefile.include
+
+ifeq ($(force_fixdep),1)
+goals := $(filter-out all sub-make, $(MAKECMDGOALS))
+
+$(goals) all: sub-make
+
+sub-make: fixdep
+	$(Q)$(MAKE) FIXDEP=1 -f Makefile.perf $(goals)
+
+else # force_fixdep
+
 # Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.
 # Without this setting the output feature dump file misses some features, for
 # example, liberty. Select all checkers so we won't get an incomplete feature
@@ -348,10 +377,6 @@ strip: $(PROGRAMS) $(OUTPUT)perf

 PERF_IN := $(OUTPUT)perf-in.o

-export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK
-export HOSTCC HOSTLD HOSTAR
-include $(srctree)/tools/build/Makefile.include
-
 JEVENTS       := $(OUTPUT)pmu-events/jevents
 JEVENTS_IN    := $(OUTPUT)pmu-events/jevents-in.o

@@ -470,7 +495,7 @@ $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS) \
 		$(PERF_IN) $(PMU_EVENTS_IN) $(LIBS) -o $@

-$(GTK_IN): fixdep FORCE
+$(GTK_IN): FORCE
 	$(Q)$(MAKE) $(build)=gtk

 $(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
@@ -515,7 +540,7 @@ endif
 __build-dir = $(subst $(OUTPUT),,$(dir $@))
 build-dir   = $(if $(__build-dir),$(__build-dir),.)

-prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h fixdep archheaders
+prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders

 $(OUTPUT)%.o: %.c prepare FORCE
 	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
@@ -555,7 +580,7 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(wi

 LIBPERF_IN := $(OUTPUT)libperf-in.o

-$(LIBPERF_IN): prepare fixdep FORCE
+$(LIBPERF_IN): prepare FORCE
 	$(Q)$(MAKE) $(build)=libperf

 $(LIB_FILE): $(LIBPERF_IN)
@@ -563,10 +588,10 @@ $(LIB_FILE): $(LIBPERF_IN)

 LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)

-$(LIBTRACEEVENT): fixdep FORCE
+$(LIBTRACEEVENT): FORCE
 	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a

-libtraceevent_plugins: fixdep FORCE
+libtraceevent_plugins: FORCE
 	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins

 $(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
@@ -579,21 +604,21 @@ $(LIBTRACEEVENT)-clean:
 install-traceevent-plugins: libtraceevent_plugins
 	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins

-$(LIBAPI): fixdep FORCE
+$(LIBAPI): FORCE
 	$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a

 $(LIBAPI)-clean:
 	$(call QUIET_CLEAN, libapi)
 	$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null

-$(LIBBPF): fixdep FORCE
+$(LIBBPF): FORCE
 	$(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)

 $(LIBBPF)-clean:
 	$(call QUIET_CLEAN, libbpf)
 	$(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) clean >/dev/null

-$(LIBSUBCMD): fixdep FORCE
+$(LIBSUBCMD): FORCE
 	$(Q)$(MAKE) -C $(SUBCMD_DIR) O=$(OUTPUT) $(OUTPUT)libsubcmd.a

 $(LIBSUBCMD)-clean:
@@ -790,3 +815,4 @@ FORCE:
 .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE prepare
 .PHONY: libtraceevent_plugins archheaders

+endif # force_fixdep


code:
From 8ac1eb7bab7c8d9d6f00b3e2a408611c45d9dff0 Mon Sep 17 00:00:00 2001
From: Jiri Olsa <jolsa@kernel.org>
Date: Tue, 6 Dec 2016 14:18:50 +0100
Subject: [PATCH] perf tools: Move perf build related variables under non
 fixdep leg

Because there's no need for them in fixdep build.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481030331-31944-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 33b1d9f..8f1c258 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -164,11 +164,6 @@ BISON   = bison
 STRIP   = strip
 AWK     = awk

-LIB_DIR		= $(srctree)/tools/lib/api/
-TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
-BPF_DIR		= $(srctree)/tools/lib/bpf/
-SUBCMD_DIR	= $(srctree)/tools/lib/subcmd/
-
 # include Makefile.config by default and rule out
 # non-config cases
 config := 1
@@ -210,6 +205,11 @@ sub-make: fixdep

 else # force_fixdep

+LIB_DIR         = $(srctree)/tools/lib/api/
+TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
+BPF_DIR         = $(srctree)/tools/lib/bpf/
+SUBCMD_DIR      = $(srctree)/tools/lib/subcmd/
+
 # Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.
 # Without this setting the output feature dump file misses some features, for
 # example, liberty. Select all checkers so we won't get an incomplete feature
--
2.10.2


code:
--- linux/tools/testing/selftests/Makefile.orig
+++ linux/tools/testing/selftests/Makefile
@@ -16,7 +16,6 @@ TARGETS += mount
 TARGETS += mqueue
 TARGETS += net
 TARGETS += nsfs
-TARGETS += powerpc
 TARGETS += pstore
 TARGETS += ptrace
 TARGETS += seccomp


code:
--- linux/drivers/usb/storage/unusual_devs.h.orig	2012-12-06 18:26:48.639813048 +0200
+++ linux/drivers/usb/storage/unusual_devs.h	2012-12-06 18:27:16.570440504 +0200
@@ -2046,16 +2046,16 @@ UNUSUAL_DEV( 0xed10, 0x7636, 0x0001, 0x0
 UNUSUAL_DEV( 0x0584, 0x0001, 0x0100, 0x0102,
 		"RATOCSystems",
 		"Compact Flash Adapter",
-		US_SC_SCSI, US_PR_BULK, NULL,
+		USB_SC_SCSI, USB_PR_BULK, NULL,
 		US_FL_SINGLE_LUN | US_FL_MAX_SECTORS_MIN),

 /*
  * Panasonic/OEMs compact USB CDROMs status
  * KXL-840(CD-ROM11): usb_stor_Bulk_max_lun() is danger, need US_FL_SINGLE_LUN
  * KXL-RW11(CDRRW02): usb_stor_Bulk_max_lun() is danger, need US_FL_SINGLE_LUN
- * KXL-RW20(CDRRW03): original IClass is 0xFF, use US_PR_CB and need init reset
+ * KXL-RW20(CDRRW03): original IClass is 0xFF, use USB_PR_CB and need init reset
  * KXL-RW31(CDRRW05): work fine with current code
- * KXL-RW21(CDRRW06): original IClass is 0xFF, use US_PR_CB and need init reset
+ * KXL-RW21(CDRRW06): original IClass is 0xFF, use USB_PR_CB and need init reset
  * KXL-RW32(CDRRW09): work fine with current code
  * KXL-RW40(CDRRW10): work fine with current code
  *      Checked: Go Taniguchi <go@turbolinux.co.jp>
@@ -2063,19 +2063,19 @@ UNUSUAL_DEV( 0x0584, 0x0001, 0x0100, 0x0
 UNUSUAL_DEV( 0x04da, 0x0d01, 0x0000, 0xffff,
 		"Panasonic",
 		"CD-ROM11",
-		US_SC_8020, US_PR_BULK, NULL, US_FL_SINGLE_LUN),
+		USB_SC_8020, USB_PR_BULK, NULL, US_FL_SINGLE_LUN),
 UNUSUAL_DEV( 0x04da, 0x0d02, 0x0000, 0xffff,
 		"Panasonic",
 		"CDRRW02",
-		US_SC_8020, US_PR_BULK, NULL, US_FL_SINGLE_LUN),
+		USB_SC_8020, USB_PR_BULK, NULL, US_FL_SINGLE_LUN),
 UNUSUAL_DEV( 0x04da, 0x0d03, 0x0000, 0xffff,
 		"Panasonic",
 		"CDRRW03",
-		US_SC_8020, US_PR_CB, NULL, US_FL_MAX_SECTORS_MIN),
+		USB_SC_8020, USB_PR_CB, NULL, US_FL_MAX_SECTORS_MIN),
 UNUSUAL_DEV( 0x04da, 0x0d06, 0x0000, 0xffff,
 		"Panasonic",
 		"CDRRW06",
-		US_SC_8020, US_PR_CB, NULL, US_FL_MAX_SECTORS_MIN),
+		USB_SC_8020, USB_PR_CB, NULL, US_FL_MAX_SECTORS_MIN),

 /* Control/Bulk transport for all SubClass values */
 USUAL_DEV(USB_SC_RBC, USB_PR_CB),


code:
Subject: Change to usb storage of unusual_dev.

This patch is japanease unique USB devices quirks.
There are many unique USB CD, which probides by Panasonic.
I try to use all models. all devices worked fine.

Signed-off-by: Go Taniguchi <go@turbolinux.co.jp>

---
 drivers/usb/storage/unusual_devs.h |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

--- linux/drivers/usb/storage/unusual_devs.h.orig	2014-06-03 21:48:03.211099341 +0300
+++ linux/drivers/usb/storage/unusual_devs.h	2014-06-04 21:57:21.546299167 +0300
@@ -2105,6 +2105,40 @@ UNUSUAL_DEV( 0xed10, 0x7636, 0x0001, 0x0
 #include "unusual_uas.h"
 #endif

+UNUSUAL_DEV( 0x0584, 0x0001, 0x0100, 0x0102,
+		"RATOCSystems",
+		"Compact Flash Adapter",
+		US_SC_SCSI, US_PR_BULK, NULL,
+		US_FL_SINGLE_LUN | US_FL_MAX_SECTORS_MIN),
+
+/*
+ * Panasonic/OEMs compact USB CDROMs status
+ * KXL-840(CD-ROM11): usb_stor_Bulk_max_lun() is danger, need US_FL_SINGLE_LUN
+ * KXL-RW11(CDRRW02): usb_stor_Bulk_max_lun() is danger, need US_FL_SINGLE_LUN
+ * KXL-RW20(CDRRW03): original IClass is 0xFF, use US_PR_CB and need init reset
+ * KXL-RW31(CDRRW05): work fine with current code
+ * KXL-RW21(CDRRW06): original IClass is 0xFF, use US_PR_CB and need init reset
+ * KXL-RW32(CDRRW09): work fine with current code
+ * KXL-RW40(CDRRW10): work fine with current code
+ *      Checked: Go Taniguchi <go@turbolinux.co.jp>
+ */
+UNUSUAL_DEV( 0x04da, 0x0d01, 0x0000, 0xffff,
+		"Panasonic",
+		"CD-ROM11",
+		US_SC_8020, US_PR_BULK, NULL, US_FL_SINGLE_LUN),
+UNUSUAL_DEV( 0x04da, 0x0d02, 0x0000, 0xffff,
+		"Panasonic",
+		"CDRRW02",
+		US_SC_8020, US_PR_BULK, NULL, US_FL_SINGLE_LUN),
+UNUSUAL_DEV( 0x04da, 0x0d03, 0x0000, 0xffff,
+		"Panasonic",
+		"CDRRW03",
+		US_SC_8020, US_PR_CB, NULL, US_FL_MAX_SECTORS_MIN),
+UNUSUAL_DEV( 0x04da, 0x0d06, 0x0000, 0xffff,
+		"Panasonic",
+		"CDRRW06",
+		US_SC_8020, US_PR_CB, NULL, US_FL_MAX_SECTORS_MIN),
+
 /* Control/Bulk transport for all SubClass values */
 USUAL_DEV(USB_SC_RBC, USB_PR_CB),
 USUAL_DEV(USB_SC_8020, USB_PR_CB),