Commit 65bc2fe8 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Mauro Carvalho Chehab
Browse files

[media] cx88: convert it to use pr_foo() macros



Instead of calling printk() directly, use pr_foo()
macros, as suggested at the Kernel's coding style.

Please notice that a conversion to dev_foo() is not trivial,
as several parts on this driver uses pr_cont().

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 3b0cb24f
Loading
Loading
Loading
Loading
+10 −16
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "cx88.h"
#include "cx88-reg.h"

#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
@@ -42,17 +45,10 @@
#include <sound/tlv.h>
#include <media/i2c/wm8775.h>

#include "cx88.h"
#include "cx88-reg.h"

#define dprintk(level, fmt, arg...) do {				\
	if (debug + 1 > level)						\
		printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg);\
} while(0)

#define dprintk_core(level, fmt, arg...) do {				\
	if (debug + 1 > level)						\
		printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg);\
		printk(KERN_DEBUG pr_fmt("%s: alsa: " fmt),		\
			chip->core->name, ##arg);			\
} while (0)

/****************************************************************************
@@ -230,12 +226,12 @@ static void cx8801_aud_irq(snd_cx88_card_t *chip)
		return;
	cx_write(MO_AUD_INTSTAT, status);
	if (debug > 1  ||  (status & mask & ~0xff))
		cx88_print_irqbits(core->name, "irq aud",
		cx88_print_irqbits("irq aud",
				   cx88_aud_irqs, ARRAY_SIZE(cx88_aud_irqs),
				   status, mask);
	/* risc op code error */
	if (status & AUD_INT_OPC_ERR) {
		printk(KERN_WARNING "%s/1: Audio risc op code error\n",core->name);
		pr_warn("Audio risc op code error\n");
		cx_clear(MO_AUD_DMACNTRL, 0x11);
		cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH25]);
	}
@@ -279,9 +275,7 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id)
	}

	if (MAX_IRQ_LOOP == loop) {
		printk(KERN_ERR
		       "%s/1: IRQ loop detected, disabling interrupts\n",
		       core->name);
		pr_err("IRQ loop detected, disabling interrupts\n");
		cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT);
	}

@@ -423,7 +417,7 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
	int err;

	if (!chip) {
		printk(KERN_ERR "BUG: cx88 can't find device struct. Can't proceed with open\n");
		pr_err("BUG: cx88 can't find device struct. Can't proceed with open\n");
		return -ENODEV;
	}

+15 −16
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "cx88.h"

#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
@@ -38,8 +40,6 @@
#include <media/v4l2-event.h>
#include <media/drv-intf/cx2341x.h>

#include "cx88.h"

MODULE_DESCRIPTION("driver for cx2388x/cx23416 based mpeg encoder cards");
MODULE_AUTHOR("Jelle Foks <jelle@foks.us>, Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
@@ -51,7 +51,8 @@ MODULE_PARM_DESC(debug,"enable debug messages [blackbird]");

#define dprintk(level, fmt, arg...) do {				\
	if (debug + 1 > level)						\
		printk(KERN_DEBUG "%s/2-bb: " fmt, dev->core->name , ## arg); \
		printk(KERN_DEBUG pr_fmt("%s: blackbird:" fmt),		\
			__func__, ##arg);				\
} while (0)

/* ------------------------------------------------------------------ */
@@ -1118,12 +1119,11 @@ static int blackbird_register_video(struct cx8802_dev *dev)
	dev->mpeg_dev.queue = &dev->vb2_mpegq;
	err = video_register_device(&dev->mpeg_dev, VFL_TYPE_GRABBER, -1);
	if (err < 0) {
		printk(KERN_INFO "%s/2: can't register mpeg device\n",
		       dev->core->name);
		pr_info("can't register mpeg device\n");
		return err;
	}
	printk(KERN_INFO "%s/2: registered device %s [mpeg]\n",
	       dev->core->name, video_device_node_name(&dev->mpeg_dev));
	pr_info("registered device %s [mpeg]\n",
		video_device_node_name(&dev->mpeg_dev));
	return 0;
}

@@ -1158,8 +1158,7 @@ static int cx8802_blackbird_probe(struct cx8802_driver *drv)
	v4l2_ctrl_add_handler(&dev->cxhdl.hdl, &core->video_hdl, NULL);

	/* blackbird stuff */
	printk("%s/2: cx23416 based mpeg encoder (blackbird reference design)\n",
	       core->name);
	pr_info("cx23416 based mpeg encoder (blackbird reference design)\n");
	host_setup(dev->core);

	blackbird_initialize_codec(dev);
@@ -1219,7 +1218,7 @@ static struct cx8802_driver cx8802_blackbird_driver = {

static int __init blackbird_init(void)
{
	printk(KERN_INFO "cx2388x blackbird driver version %s loaded\n",
	pr_info("cx2388x blackbird driver version %s loaded\n",
		CX88_VERSION);
	return cx8802_register_driver(&cx8802_blackbird_driver);
}
+41 −62
Original line number Diff line number Diff line
@@ -20,16 +20,16 @@
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "cx88.h"
#include "tea5767.h"
#include "xc4000.h"

#include <linux/init.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/slab.h>

#include "cx88.h"
#include "tea5767.h"
#include "xc4000.h"

static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
static unsigned int card[]  = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
@@ -50,18 +50,10 @@ static int disable_ir;
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(disable_ir, "Disable IR support");

#define info_printk(core, fmt, arg...) \
	printk(KERN_INFO "%s: " fmt, core->name , ## arg)

#define warn_printk(core, fmt, arg...) \
	printk(KERN_WARNING "%s: " fmt, core->name , ## arg)

#define err_printk(core, fmt, arg...) \
	printk(KERN_ERR "%s: " fmt, core->name , ## arg)

#define dprintk(level,fmt, arg...)	do {				\
	if (cx88_core_debug >= level)					\
		printk(KERN_DEBUG "%s: " fmt, core->name , ## arg);	\
		printk(KERN_DEBUG pr_fmt("%s: core:" fmt),		\
			__func__, ##arg);				\
} while (0)


@@ -2829,7 +2821,7 @@ static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
	if (eeprom_data[4] != 0x7d ||
	    eeprom_data[5] != 0x10 ||
	    eeprom_data[7] != 0x66) {
		warn_printk(core, "Leadtek eeprom invalid.\n");
		pr_warn("Leadtek eeprom invalid.\n");
		return;
	}

@@ -2847,7 +2839,7 @@ static void leadtek_eeprom(struct cx88_core *core, u8 *eeprom_data)
		break;
	}

	info_printk(core, "Leadtek Winfast 2000XP Expert config: tuner=%d, eeprom[0]=0x%02x\n",
	pr_info("Leadtek Winfast 2000XP Expert config: tuner=%d, eeprom[0]=0x%02x\n",
		core->board.tuner_type, eeprom_data[0]);
}

@@ -2904,12 +2896,11 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
		cx_set(MO_GP0_IO, 0x008989FF);
		break;
	default:
		warn_printk(core, "warning: unknown hauppauge model #%d\n",
			    tv.model);
		pr_warn("warning: unknown hauppauge model #%d\n", tv.model);
		break;
	}

	info_printk(core, "hauppauge eeprom: model=%d\n", tv.model);
	pr_info("hauppauge eeprom: model=%d\n", tv.model);
}

/* ----------------------------------------------------------------------- */
@@ -2955,7 +2946,7 @@ static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
	const char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
		? gdi_tuner[eeprom_data[0x0d]].name : NULL;

	info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
	pr_info("GDI: tuner=%s\n", name ? name : "unknown");
	if (NULL == name)
		return;
	core->board.tuner_type = gdi_tuner[eeprom_data[0x0d]].id;
@@ -3106,7 +3097,7 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
		msg.len = (i != 12 ? 5 : 2);
		err = i2c_transfer(&core->i2c_adap, &msg, 1);
		if (err != 1) {
			warn_printk(core, "dvico_fusionhdtv_hybrid_init buf %d failed (err = %d)!\n",
			pr_warn("dvico_fusionhdtv_hybrid_init buf %d failed (err = %d)!\n",
				i, err);
			return;
		}
@@ -3229,14 +3220,14 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg)
	struct cx88_core *core;

	if (!i2c_algo) {
		printk(KERN_ERR "cx88: Error - i2c private data undefined.\n");
		pr_err("Error - i2c private data undefined.\n");
		return -EINVAL;
	}

	core = i2c_algo->data;

	if (!core) {
		printk(KERN_ERR "cx88: Error - device struct undefined.\n");
		pr_err("Error - device struct undefined.\n");
		return -EINVAL;
	}

@@ -3254,7 +3245,7 @@ int cx88_tuner_callback(void *priv, int component, int command, int arg)
			dprintk(1, "Calling XC5000 callback\n");
			return cx88_xc5000_tuner_callback(core, command, arg);
	}
	err_printk(core, "Error: Calling callback for tuner %d\n",
	pr_err("Error: Calling callback for tuner %d\n",
	       core->board.tuner_type);
	return -EINVAL;
}
@@ -3268,25 +3259,19 @@ static void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)

	if (0 == pci->subsystem_vendor &&
	    0 == pci->subsystem_device) {
		printk(KERN_ERR
		       "%s: Your board has no valid PCI Subsystem ID and thus can't\n"
		       "%s: be autodetected.  Please pass card=<n> insmod option to\n"
		       "%s: workaround that.  Redirect complaints to the vendor of\n"
		       "%s: the TV card.  Best regards,\n"
		       "%s:         -- tux\n",
		       core->name,core->name,core->name,core->name,core->name);
		pr_err("Your board has no valid PCI Subsystem ID and thus can't\n");
		pr_err("be autodetected.  Please pass card=<n> insmod option to\n");
		pr_err("workaround that.  Redirect complaints to the vendor of\n");
		pr_err("the TV card\n");
	} else {
		printk(KERN_ERR
		       "%s: Your board isn't known (yet) to the driver.  You can\n"
		       "%s: try to pick one of the existing card configs via\n"
		       "%s: card=<n> insmod option.  Updating to the latest\n"
		       "%s: version might help as well.\n",
		       core->name,core->name,core->name,core->name);
	}
	err_printk(core, "Here is a list of valid choices for the card=<n> insmod option:\n");
		pr_err("Your board isn't known (yet) to the driver.  You can\n");
		pr_err("try to pick one of the existing card configs via\n");
		pr_err("card=<n> insmod option.  Updating to the latest\n");
		pr_err("version might help as well.\n");
	}
	pr_err("Here is a list of valid choices for the card=<n> insmod option:\n");
	for (i = 0; i < ARRAY_SIZE(cx88_boards); i++)
		printk(KERN_ERR "%s:    card=%d -> %s\n",
		       core->name, i, cx88_boards[i].name);
		pr_err("    card=%d -> %s\n", i, cx88_boards[i].name);
}

static void cx88_card_setup_pre_i2c(struct cx88_core *core)
@@ -3508,7 +3493,7 @@ static void cx88_card_setup(struct cx88_core *core)
			for (i = 0; i < ARRAY_SIZE(buffer); i++)
				if (2 != i2c_master_send(&core->i2c_client,
							buffer[i],2))
					warn_printk(core, "Unable to enable tuner(%i).\n",
					pr_warn("Unable to enable tuner(%i).\n",
						i);
		}
		break;
@@ -3608,29 +3593,24 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)

	/* check pci quirks */
	if (pci_pci_problems & PCIPCI_TRITON) {
		printk(KERN_INFO "%s: quirk: PCIPCI_TRITON -- set TBFX\n",
		       name);
		pr_info("quirk: PCIPCI_TRITON -- set TBFX\n");
		ctrl |= CX88X_EN_TBFX;
	}
	if (pci_pci_problems & PCIPCI_NATOMA) {
		printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA -- set TBFX\n",
		       name);
		pr_info("quirk: PCIPCI_NATOMA -- set TBFX\n");
		ctrl |= CX88X_EN_TBFX;
	}
	if (pci_pci_problems & PCIPCI_VIAETBF) {
		printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF -- set TBFX\n",
		       name);
		pr_info("quirk: PCIPCI_VIAETBF -- set TBFX\n");
		ctrl |= CX88X_EN_TBFX;
	}
	if (pci_pci_problems & PCIPCI_VSFX) {
		printk(KERN_INFO "%s: quirk: PCIPCI_VSFX -- set VSFX\n",
		       name);
		pr_info("quirk: PCIPCI_VSFX -- set VSFX\n");
		ctrl |= CX88X_EN_VSFX;
	}
#ifdef PCIPCI_ALIMAGIK
	if (pci_pci_problems & PCIPCI_ALIMAGIK) {
		printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n",
		       name);
		pr_info("quirk: PCIPCI_ALIMAGIK -- latency fixup\n");
		lat = 0x0A;
	}
#endif
@@ -3646,8 +3626,8 @@ static int cx88_pci_quirks(const char *name, struct pci_dev *pci)
		pci_write_config_byte(pci, CX88X_DEVCTRL, value);
	}
	if (UNSET != lat) {
		printk(KERN_INFO "%s: setting pci latency timer to %d\n",
		       name, latency);
		pr_info("setting pci latency timer to %d\n",
			latency);
		pci_write_config_byte(pci, PCI_LATENCY_TIMER, latency);
	}
	return 0;
@@ -3659,9 +3639,8 @@ int cx88_get_resources(const struct cx88_core *core, struct pci_dev *pci)
			       pci_resource_len(pci,0),
			       core->name))
		return 0;
	printk(KERN_ERR
	       "%s/%d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
	       core->name, PCI_FUNC(pci->devfn),
	pr_err("func %d: Can't get MMIO memory @ 0x%llx, subsystem: %04x:%04x\n",
	       PCI_FUNC(pci->devfn),
	       (unsigned long long)pci_resource_start(pci, 0),
	       pci->subsystem_vendor, pci->subsystem_device);
	return -EBUSY;
@@ -3755,7 +3734,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
	if (!core->board.num_frontends && (core->board.mpeg & CX88_MPEG_DVB))
		core->board.num_frontends = 1;

	info_printk(core, "subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
	pr_info("subsystem: %04x:%04x, board: %s [card=%d,%s], frontend(s): %d\n",
		pci->subsystem_vendor, pci->subsystem_device, core->board.name,
		core->boardnr, card[core->nr] == core->boardnr ?
		"insmod option" : "autodetected",
+65 −61
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "cx88.h"

#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
@@ -38,7 +40,6 @@
#include <linux/videodev2.h>
#include <linux/mutex.h>

#include "cx88.h"
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>

@@ -60,9 +61,14 @@ static unsigned int nocomb;
module_param(nocomb,int,0644);
MODULE_PARM_DESC(nocomb,"disable comb filter");

#define dprintk0(fmt, arg...)				\
	printk(KERN_DEBUG pr_fmt("%s: core:" fmt),	\
		__func__, ##arg)			\

#define dprintk(level, fmt, arg...)	do {			\
	if (cx88_core_debug >= level)				\
		printk(KERN_DEBUG "%s: " fmt, core->name , ## arg);	\
		printk(KERN_DEBUG pr_fmt("%s: core:" fmt),	\
		       __func__, ##arg);			\
} while (0)

static unsigned int cx88_devcount;
@@ -399,12 +405,12 @@ static int cx88_risc_decode(u32 risc)
	};
	int i;

	printk(KERN_DEBUG "0x%08x [ %s", risc,
	dprintk0("0x%08x [ %s", risc,
	       instr[risc >> 28] ? instr[risc >> 28] : "INVALID");
	for (i = ARRAY_SIZE(bits)-1; i >= 0; i--)
		if (risc & (1 << (i + 12)))
			printk(KERN_CONT " %s", bits[i]);
	printk(KERN_CONT " count=%d ]\n", risc & 0xfff);
			pr_cont(" %s", bits[i]);
	pr_cont(" count=%d ]\n", risc & 0xfff);
	return incr[risc >> 28] ? incr[risc >> 28] : 1;
}

@@ -428,43 +434,39 @@ void cx88_sram_channel_dump(struct cx88_core *core,
	u32 risc;
	unsigned int i,j,n;

	printk(KERN_DEBUG "%s: %s - dma channel status dump\n",
	       core->name,ch->name);
	dprintk0("%s - dma channel status dump\n",
		ch->name);
	for (i = 0; i < ARRAY_SIZE(name); i++)
		printk(KERN_DEBUG "%s:   cmds: %-12s: 0x%08x\n",
		       core->name,name[i],
		dprintk0("   cmds: %-12s: 0x%08x\n",
			name[i],
			cx_read(ch->cmds_start + 4*i));
	for (n = 1, i = 0; i < 4; i++) {
		risc = cx_read(ch->cmds_start + 4 * (i+11));
		printk(KERN_CONT "%s:   risc%d: ", core->name, i);
		pr_cont("  risc%d: ", i);
		if (--n)
			printk(KERN_CONT "0x%08x [ arg #%d ]\n", risc, n);
			pr_cont("0x%08x [ arg #%d ]\n", risc, n);
		else
			n = cx88_risc_decode(risc);
	}
	for (i = 0; i < 16; i += n) {
		risc = cx_read(ch->ctrl_start + 4 * i);
		printk(KERN_DEBUG "%s:   iq %x: ", core->name, i);
		dprintk0("  iq %x: ", i);
		n = cx88_risc_decode(risc);
		for (j = 1; j < n; j++) {
			risc = cx_read(ch->ctrl_start + 4 * (i+j));
			printk(KERN_CONT "%s:   iq %x: 0x%08x [ arg #%d ]\n",
			       core->name, i+j, risc, j);
			pr_cont("  iq %x: 0x%08x [ arg #%d ]\n",
				i + j, risc, j);
		}
	}

	printk(KERN_DEBUG "%s: fifo: 0x%08x -> 0x%x\n",
	       core->name, ch->fifo_start, ch->fifo_start+ch->fifo_size);
	printk(KERN_DEBUG "%s: ctrl: 0x%08x -> 0x%x\n",
	       core->name, ch->ctrl_start, ch->ctrl_start+6*16);
	printk(KERN_DEBUG "%s:   ptr1_reg: 0x%08x\n",
	       core->name,cx_read(ch->ptr1_reg));
	printk(KERN_DEBUG "%s:   ptr2_reg: 0x%08x\n",
	       core->name,cx_read(ch->ptr2_reg));
	printk(KERN_DEBUG "%s:   cnt1_reg: 0x%08x\n",
	       core->name,cx_read(ch->cnt1_reg));
	printk(KERN_DEBUG "%s:   cnt2_reg: 0x%08x\n",
	       core->name,cx_read(ch->cnt2_reg));
	dprintk0("fifo: 0x%08x -> 0x%x\n",
	       ch->fifo_start, ch->fifo_start+ch->fifo_size);
	dprintk0("ctrl: 0x%08x -> 0x%x\n",
	       ch->ctrl_start, ch->ctrl_start + 6 * 16);
	dprintk0("  ptr1_reg: 0x%08x\n", cx_read(ch->ptr1_reg));
	dprintk0("  ptr2_reg: 0x%08x\n", cx_read(ch->ptr2_reg));
	dprintk0("  cnt1_reg: 0x%08x\n", cx_read(ch->cnt1_reg));
	dprintk0("  cnt2_reg: 0x%08x\n", cx_read(ch->cnt2_reg));
}

static const char *cx88_pci_irqs[32] = {
@@ -474,24 +476,24 @@ static const char *cx88_pci_irqs[32] = {
	"i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
};

void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
void cx88_print_irqbits(const char *tag, const char *strings[],
			int len, u32 bits, u32 mask)
{
	unsigned int i;

	printk(KERN_DEBUG "%s: %s [0x%x]", name, tag, bits);
	dprintk0("%s [0x%x]", tag, bits);
	for (i = 0; i < len; i++) {
		if (!(bits & (1 << i)))
			continue;
		if (strings[i])
			printk(KERN_CONT " %s", strings[i]);
			pr_cont(" %s", strings[i]);
		else
			printk(KERN_CONT " %d", i);
			pr_cont(" %d", i);
		if (!(mask & (1 << i)))
			continue;
		printk(KERN_CONT "*");
		pr_cont("*");
	}
	printk(KERN_CONT "\n");
	pr_cont("\n");
}

/* ------------------------------------------------------------------ */
@@ -505,7 +507,7 @@ int cx88_core_irq(struct cx88_core *core, u32 status)
		handled++;
	}
	if (!handled)
		cx88_print_irqbits(core->name, "irq pci",
		cx88_print_irqbits("irq pci",
				   cx88_pci_irqs, ARRAY_SIZE(cx88_pci_irqs),
				   status, core->pci_irqmask);
	return handled;
@@ -551,7 +553,7 @@ void cx88_shutdown(struct cx88_core *core)

int cx88_reset(struct cx88_core *core)
{
	dprintk(1,"%s\n",__func__);
	dprintk(1, "");
	cx88_shutdown(core);

	/* clear irq status */
@@ -743,7 +745,7 @@ static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
	do_div(pll,xtal);
	reg = (pll & 0x3ffffff) | (pre[prescale] << 26);
	if (((reg >> 20) & 0x3f) < 14) {
		printk("%s/0: pll out of range\n",core->name);
		pr_err("pll out of range\n");
		return -1;
	}

@@ -836,8 +838,8 @@ static int set_tvaudio(struct cx88_core *core)
		core->tvaudio = WW_EIAJ;

	} else {
		printk("%s/0: tvaudio support needs work for this tv norm [%s], sorry\n",
		       core->name, v4l2_norm_to_name(core->tvnorm));
		pr_info("tvaudio support needs work for this tv norm [%s], sorry\n",
			v4l2_norm_to_name(core->tvnorm));
		core->tvaudio = WW_NONE;
		return 0;
	}
@@ -953,7 +955,8 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
	// bdelay + agcdelay
	bdelay   = vdec_clock * 65 / 20000000 + 21;
	agcdelay = vdec_clock * 68 / 20000000 + 15;
	dprintk(1,"set_tvnorm: MO_AGC_BURST     0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n",
	dprintk(1,
		"set_tvnorm: MO_AGC_BURST     0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n",
		(bdelay << 8) | agcdelay, cx_read(MO_AGC_BURST), bdelay, agcdelay);
	cx_write(MO_AGC_BURST, (bdelay << 8) | agcdelay);

@@ -961,7 +964,8 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
	tmp64 = norm_htotal(norm) * (u64)vdec_clock;
	do_div(tmp64, fsc8);
	htotal = (u32)tmp64;
	dprintk(1,"set_tvnorm: MO_HTOTAL        0x%08x [old=0x%08x,htotal=%d]\n",
	dprintk(1,
		"set_tvnorm: MO_HTOTAL        0x%08x [old=0x%08x,htotal=%d]\n",
		htotal, cx_read(MO_HTOTAL), (u32)tmp64);
	cx_andor(MO_HTOTAL, 0x07ff, htotal);

+10 −7
Original line number Diff line number Diff line
@@ -19,15 +19,15 @@
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "cx88.h"
#include "cx88-reg.h"

#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/jiffies.h>
#include <asm/div64.h>

#include "cx88.h"
#include "cx88-reg.h"

#define INT_PI			((s32)(3.141592653589 * 32768.0))

#define compat_remainder(a, b) \
@@ -71,8 +71,11 @@ static unsigned int dsp_debug;
module_param(dsp_debug, int, 0644);
MODULE_PARM_DESC(dsp_debug, "enable audio dsp debug messages");

#define dprintk(level, fmt, arg...)	if (dsp_debug >= level) \
	printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
#define dprintk(level, fmt, arg...) do {				\
	if (dsp_debug >= level)						\
		printk(KERN_DEBUG pr_fmt("%s: dsp:" fmt),		\
			__func__, ##arg);				\
} while (0)

static s32 int_cos(u32 x)
{
@@ -176,8 +179,8 @@ static s32 detect_a2_a2m_eiaj(struct cx88_core *core, s16 x[], u32 N)
		dual_freq = FREQ_EIAJ_DUAL;
		break;
	default:
		printk(KERN_WARNING "%s/0: unsupported audio mode %d for %s\n",
		       core->name, core->tvaudio, __func__);
		pr_warn("unsupported audio mode %d for %s\n",
			core->tvaudio, __func__);
		return UNSET;
	}

Loading