[PATCH] Re: dkms-agrsm-2.1.80-2mdv2009.0.i586.rpm fails with kernel >= 2.6.29.X

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bjorn/All,

 I played with the source a bit more this morning. This is the patch against
 the agrsm-2.1.80-4mdv2009.0.tgz sources available at the Zsolt's site.
 
 It does two things:
 (1) Adds support for the 2.6.27-rc9, 2.6.29.1 (and maybe 2.6.28) kernel
 (2) Changes the Makefile to use the standard 2.6 kbuild procedure
     used for the linux modules [described in Documentation/kbuild/modules.txt]

 Before applying the patch and running make, please rename the file 
agrmodemlib.o to agrmodemlib.o_shipped . This will help the kbuild
 to recognize this is a pre-build binary coming from elsewhere,
 so that 'make clean' will not destroy it.
 
 After the patch, build & install like this:

$ sudo modprobe -r agrserial
$ sudo modprobe -r agrmodem
$ make
$ sudo make modules_install
$ sudo modprobe agrmodem
$ sudo modprobe agrserial
$ sudo ln -s /dev/ttyAGS3 /dev/ttySAGR
$ sudo wvdialconf /etc/wvdial.conf

wvdialconf was successful on my notebook that has the 11c11040 chip on HDA, but
I cannot test beyond that -- I don't have an actual phone line here.

-- 
WBR, Nikolay Zhuravlev

Thus spake Bjorn Wielens (Uniacke1@xxxxxxxx):

> Hi,
> Zsolt's sources are confirmed to work with 2.6.27 kernels.
> However, we are still unsure about 2.6.28, and I will be able to try and
> experiment with 2.6.29 as soon as I can locate the correct packages for
> my distro.
> You are likely correct about the problem, but there may be other issues
> as well.
> Bjorn.
> 
> 
> 
> 
> Nikolay Zhuravlev wrote:
> > Antonio,
> > 
> >  Those sources are too old to work with the kernels >= 2.6.27
> > 
> >  You may want to have a look at the sources located at
> > http://linux.zsolttech.com/linmodem/agrsm/ and hack those with
> >  the patch I attach here. I used it to get the driver working
> >  with the 2.6.27-rc9 kernel.
> >  Note that the patched sources may build and still not work with
> > the recent kernels (28 and higher).
> >  
> >  I guess the HDA.c stuff in that driver is out of sync with
> >  the current ALSA developments in the 29 kernel anyway.
> > 
> > 
> 


diff -Naur agrsm-2.1.80-4mdv2009.0.old/agrsoftmodem.c agrsm-2.1.80-4mdv2009.0/agrsoftmodem.c
--- agrsm-2.1.80-4mdv2009.0.old/agrsoftmodem.c	2008-12-08 16:03:33.000000000 +0300
+++ agrsm-2.1.80-4mdv2009.0/agrsoftmodem.c	2009-05-16 15:56:03.000000000 +0400
@@ -132,6 +132,8 @@
 };
 MODULE_DEVICE_TABLE (usb, uss_table);
 
+#ifdef USB_MODEM
+#ifdef NONGPL
 static struct usb_driver uss_driver = { 
 //bala-dbg
 //	.owner		= THIS_MODULE, 
@@ -140,6 +142,8 @@
 	.disconnect 	= uss_disconnect, 
 	.id_table   	= uss_table, 
 };  
+#endif
+#endif
 
 struct usb_uss *dev = NULL;
 extern unsigned char IsCmdCompleted;
@@ -268,7 +272,11 @@
 fnatr void *x_request_region(unsigned long start, unsigned long n, const char *name)
 {
 //  return(request_region(start, n, name));
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)
+  return(__request_region(&ioport_resource, (start), (n), (name), 0));
+#else
   return(__request_region(&ioport_resource, (start), (n), (name)));
+#endif
 }
 
 #ifndef LT_KER_26
@@ -454,8 +462,7 @@
 	INIT_TQUEUE(x_tqueue, func, data);
 #else
 	struct work_struct *x_tqueue = (struct work_struct *) task_x;
-
-    INIT_WORK(x_tqueue, wrap_LXHardwareBottomHalf);
+    INIT_WORK(x_tqueue, (work_func_t)wrap_LXHardwareBottomHalf);
 #endif
 }
 
@@ -466,7 +473,7 @@
 	INIT_TQUEUE(x_tqueue, func, data);
 #else
 	struct work_struct *x_tqueue = (struct work_struct *) task_x;
-	INIT_WORK(x_tqueue, func);   
+	INIT_WORK(x_tqueue, (work_func_t)func);   
 #endif
 }
 
@@ -493,7 +500,7 @@
 #ifdef USB_MODEM
 
 #define to_uss_dev(d) container_of(d, struct usb_uss, kref)
-fnatr void *xkmalloc(d) { return kmalloc(d, GFP_KERNEL); }
+fnatr void *xkmalloc(size_t d) { return kmalloc(d, GFP_KERNEL); }
 fnatr void *kmalloc_dev(void) {
 	dev = kmalloc(sizeof(struct usb_uss), GFP_KERNEL);
     	if(dev) memset(dev, 0x00, sizeof(struct usb_uss));
@@ -519,7 +526,7 @@
 fnatr void *get_iface_desc(void *p) 	{return  (((struct usb_interface *)p)->cur_altsetting);}
 fnatr int  get_num_endpoints(void *p) 	{return (((struct usb_host_interface *)p)->desc.bNumEndpoints);}
 fnatr void x_kref_put(void *p) 		{if (dev)  kref_put(&dev->kref, p); }
-fnatr void x_kref_init()		{kref_init(&dev->kref);}
+fnatr void x_kref_init(void)		{kref_init(&dev->kref);}
 fnatr int  IsDirIn(int addr) 		{return (addr & USB_DIR_IN);}
 fnatr int  IsBulkXfer(int attr) 	{return ((attr & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK);}
 fnatr int  x_le16_to_cpu(int d) 	{return le16_to_cpu(d);}
@@ -529,14 +536,14 @@
 fnatr int  get_urb_status(void *p) 	{return (((struct urb *)p)->status);}
 fnatr void *get_urb_context(void *p) 	{return (((struct urb *)p)->context);}
 fnatr void *get_dev(void) 		{return dev;}
-fnatr void *x_usb_alloc_urb_kernel() 	{
+fnatr void *x_usb_alloc_urb_kernel(void) 	{
 	#ifdef NONGPL
 	return usb_alloc_urb(0, GFP_KERNEL);
 	#else 
 	return 0;
 	#endif
 }
-fnatr void *x_usb_alloc_urb_atomic() 	{
+fnatr void *x_usb_alloc_urb_atomic(void) 	{
 	#ifdef NONGPL
 	return usb_alloc_urb(0, GFP_ATOMIC);
 	#else
diff -Naur agrsm-2.1.80-4mdv2009.0.old/HDA.c agrsm-2.1.80-4mdv2009.0/HDA.c
--- agrsm-2.1.80-4mdv2009.0.old/HDA.c	2008-12-08 16:03:33.000000000 +0300
+++ agrsm-2.1.80-4mdv2009.0/HDA.c	2009-05-16 15:56:03.000000000 +0400
@@ -24,6 +24,7 @@
 #include "hda_codec.h"
 #include <sound/asoundef.h>
 #include <sound/initval.h>
+#include <linux/version.h>
 
 #define HDA_MODEM
 
@@ -246,7 +247,7 @@
 temp = (unsigned long *) chip_temp->remap_addr;
 for (i=0; i<(0x1A0/4);)
 {
-	snd_printk(KERN_ERR"HDA register %04X %08X %08X %08X %08X\n",i*4,(unsigned int)temp[i],(unsigned int)temp[i+1],(unsigned int)temp[i+2],(unsigned int)temp[i+3]);
+	snd_printk(KERN_ERR"HDA register %04X %08lX %08lX %08lX %08lX\n",i*4,temp[i],temp[i+1],temp[i+2],temp[i+3]);
 	i = i+4;
 }
 }
@@ -357,6 +358,7 @@
 return rvalue;
 }
 
+#ifdef CONFIG_SND_HDA_POWER_SAVE
 void snd_hda_power_up(struct hda_codec *codec)
 {
   return;
@@ -366,7 +368,84 @@
 {
   return;
 }
+#endif
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)
+/*
+ * Compose a 32bit command word to be sent to the HD-audio controller
+ */
+static inline unsigned int
+make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct,
+	       unsigned int verb, unsigned int parm)
+{
+	u32 val;
+
+	val = (u32)(codec->addr & 0x0f) << 28;
+	val |= (u32)direct << 27;
+	val |= (u32)nid << 20;
+	val |= verb << 8;
+	val |= parm;
+	return val;
+}
+/**
+ * snd_hda_codec_read - send a command and get the response
+ * @codec: the HDA codec
+ * @nid: NID to send the command
+ * @direct: direct flag
+ * @verb: the verb to send
+ * @parm: the parameter for the verb
+ *
+ * Send a single command and read the corresponding response.
+ *
+ * Returns the obtained response value, or -1 for an error.
+ */
+unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
+				int direct,
+				unsigned int verb, unsigned int parm)
+{
+	struct hda_bus *bus = codec->bus;
+	unsigned int res;
+
+	res = make_codec_cmd(codec, nid, direct, verb, parm);
+	snd_hda_power_up(codec);
+	mutex_lock(&bus->cmd_mutex);
+	if (!bus->ops.command(bus, res))
+		res = bus->ops.get_response(bus);
+	else
+		res = (unsigned int)-1;
+	mutex_unlock(&bus->cmd_mutex);
+	snd_hda_power_down(codec);
+	return res;
+}
+
+/**
+ * snd_hda_codec_write - send a single command without waiting for response
+ * @codec: the HDA codec
+ * @nid: NID to send the command
+ * @direct: direct flag
+ * @verb: the verb to send
+ * @parm: the parameter for the verb
+ *
+ * Send a single command without waiting for response.
+ *
+ * Returns 0 if successful, or a negative error code.
+ */
+int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct,
+			 unsigned int verb, unsigned int parm)
+{
+	struct hda_bus *bus = codec->bus;
+	unsigned int res;
+	int err;
 
+	res = make_codec_cmd(codec, nid, direct, verb, parm);
+	snd_hda_power_up(codec);
+	mutex_lock(&bus->cmd_mutex);
+	err = bus->ops.command(bus, res);
+	mutex_unlock(&bus->cmd_mutex);
+	snd_hda_power_down(codec);
+	return err;
+}
+#else
 /**
  * snd_hda_codec_write - send a single command without waiting for response
  * @codec: the HDA codec
@@ -418,4 +497,4 @@
 	snd_hda_power_down(codec);
 	return res;
 }
-
+#endif
diff -Naur agrsm-2.1.80-4mdv2009.0.old/hda_codec.h agrsm-2.1.80-4mdv2009.0/hda_codec.h
--- agrsm-2.1.80-4mdv2009.0.old/hda_codec.h	2008-12-08 16:03:33.000000000 +0300
+++ agrsm-2.1.80-4mdv2009.0/hda_codec.h	2009-05-16 15:56:03.000000000 +0400
@@ -25,6 +25,7 @@
 #include <sound/control.h>
 #include <sound/pcm.h>
 #include <sound/hwdep.h>
+#include <linux/version.h>
 
 #if defined(CONFIG_PM) || defined(CONFIG_SND_HDA_POWER_SAVE)
 #define SND_HDA_NEEDS_RESUME	/* resume control code is required */
@@ -458,6 +459,23 @@
 typedef u16 hda_nid_t;
 
 /* bus operators */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)
+struct hda_bus_ops {
+	/* send a single command */
+	int (*command)(struct hda_bus *bus, unsigned int cmd);
+	/* get a response from the last command */
+	unsigned int (*get_response)(struct hda_bus *bus);
+	/* free the private data */
+	void (*private_free)(struct hda_bus *);
+	/* attach a PCM stream */
+	int (*attach_pcm)(struct hda_bus *bus, struct hda_codec *codec,
+			  struct hda_pcm *pcm);
+#ifdef CONFIG_SND_HDA_POWER_SAVE
+	/* notify power-up/down from codec to controller */
+	void (*pm_notify)(struct hda_bus *bus);
+#endif
+};
+#else
 struct hda_bus_ops {
 	/* send a single command */
 	int (*command)(struct hda_codec *codec, hda_nid_t nid, int direct,
@@ -471,6 +489,7 @@
 	void (*pm_notify)(struct hda_codec *codec);
 #endif
 };
+#endif
 
 /* template to pass to the bus constructor */
 struct hda_bus_template {
@@ -493,6 +512,9 @@
 	void *private_data;
 	struct pci_dev *pci;
 	const char *modelname;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)
+	int *power_save;
+#endif
 	struct hda_bus_ops ops;
 
 	/* codec linked list */
@@ -504,11 +526,22 @@
 
 	/* unsolicited event queue */
 	struct hda_bus_unsolicited *unsol;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)
+	char workq_name[16];
+	struct workqueue_struct *workq;	/* common workqueue for codecs */
+
+	/* assigned PCMs */
+	DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES);
 
+	/* misc op flags */
+	unsigned int needs_damn_long_delay :1;
+	unsigned int shutdown :1;	/* being unloaded */
+#else
 	struct snd_info_entry *proc;
 
 	/* misc op flags */
 	unsigned int needs_damn_long_delay :1;
+#endif
 };
 
 /*
diff -Naur agrsm-2.1.80-4mdv2009.0.old/Kbuild agrsm-2.1.80-4mdv2009.0/Kbuild
--- agrsm-2.1.80-4mdv2009.0.old/Kbuild	1970-01-01 03:00:00.000000000 +0300
+++ agrsm-2.1.80-4mdv2009.0/Kbuild	2009-05-16 15:56:03.000000000 +0400
@@ -0,0 +1,6 @@
+obj-m += agrmodem.o agrserial.o
+
+EXTRA_CFLAGS += -Wall -DLT_KER_26
+EXTRA_LDFLAGS := -d
+agrmodem-y := agrsoftmodem.o agrmodemlib.o HDA.o
+agrserial-y := serial26.o
diff -Naur agrsm-2.1.80-4mdv2009.0.old/Makefile agrsm-2.1.80-4mdv2009.0/Makefile
--- agrsm-2.1.80-4mdv2009.0.old/Makefile	2008-06-05 16:43:34.000000000 +0400
+++ agrsm-2.1.80-4mdv2009.0/Makefile	2009-05-16 15:56:03.000000000 +0400
@@ -8,80 +8,24 @@
 #   - Modem Serail Interface driver module
 #
 # Usage:
-#   make install: to make and install the driver modules
-#   make uninstall: to uninstall the driver modules
+#   make                 - build the module(s)
+#   make modules_install - install the module(s)
+#   make clean           - remove generated files in module directory only
 #
 # Revision History:
 #   Name                   Date          Change
 #   Soumyendu Sarkar       12/03/2002    Initial
 #
 
-KERNEL_DIR = /lib/modules/`uname -r`/build/
-#KERNEL_DIR = /usr/src/linux-`uname -r | sed -e 's,\-default,,'`/
-#KERNEL_DIR = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`/
-KERNEL_DIR1 = /usr/src/linux-`uname -r`/include
-KERNEL_DIR2 = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`/include
-KERNEL_DIR5 = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`/include/asm/mach-default
-KERNEL_DIR3 = /usr/src/linux-`uname -r | sed -e 's,\..*,,'`.`uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,'`/include
-KERNEL_DIR4 = /usr/src/linux-`uname -r | sed -e 's,\-.*,,'`.SuSE/include
+PWD := $(shell pwd)
+KRELEASE = $(shell uname -r)
+KERNEL_DIR := /lib/modules/$(KRELEASE)/build
 
-I_FLAGS =  -I$(KERNEL_DIR1) -I$(KERNEL_DIR2) -I$(KERNEL_DIR5) -I$(KERNEL_DIR3) -I$(KERNEL_DIR4)/include
+default:
+	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules
 
-#C_FLAGS = -Wall -Wno-unused -O2 -fomit-frame-pointer -fno-strength-reduce  -pipe\
-#		-mcpu=i486 -falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-#		-DMODULE -D__KERNEL__ -DLT_KER_24 -DLT_KER_26 -DKERNEL_DIR -DNO_EEPROM
-
-C_FLAGS = -Wall	-Wno-unused -O1 -fomit-frame-pointer -fno-strength-reduce -pipe \
-		-fno-gcse-after-reload \
-		-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-		-DMODULE -D__KERNEL__ -DLT_KER_24 -DLT_KER_26 -DNO_EEPROM $(I_FLAGS)
-
-EXTRA_CFLAGS += -Wall -DLT_KER_24 -DLT_KER_26 -DNO_EEPROM 
-
-EXTRA_LDFLAGS := -d
-    
-help :
-	@echo ''
-	@echo 'Run "make install" to install Agere Systems Soft Modem on your system.'
-	@echo 'Run "make uninstall" to remove a previously installed modem.'
-	@echo ''
-
-agrmodem-objs := \
-        agrsoftmodem.o agrmodemlib.o HDA.o
-
-agrserial-objs := \
-	serial26.o
-
-obj-m += agrmodem.o agrserial.o
-
-module:
-#	cp ../../build/Linux/dbg-agr-linux-fedora-6-0/bin/AGRSMDM_lib.o agrmodemlib.o
-
-	make -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
-
-$(obj)/agrmodemlib.o:
-	cp $(src)/agrmodemlib.o $(obj)/agrmodemlib.o
+modules_install:
+	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install
 
 clean:
-	rm -f *.a
-	rm -f *~
-	rm -f agrmodem.o
-	rm -f agrmodem.ko
-	rm -f agrmodem.mod.o
-	rm -f agrmodem.mod.c
-	rm -f agrserial.o
-	rm -f agrserial.ko
-	rm -f agrserial.mod.o
-	rm -f agrserial.mod.c
-	rm -f agrsoftmodem.o
-	rm -f serial26.o
-	rm -f HDA.o
-
-install:
-	./agrinst
-  
-uninstall :
-	./agruninst
-
-
-	
+	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean

[Index of Archives]     [Linux Media Development]     [Asterisk]     [DCCP]     [Netdev]     [X.org]     [Xfree86]     [Fedora Women]     [Linux USB]

  Powered by Linux