Commit b1526421 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (8913): cx18: Create cx18_ specific wrappers for all pci mmio accessesors.



cx18: Create cx18_ specific wrappers for all pci mmio accessesors.  This is a
first step in instrumenting all CX23418 PCI bus IO, to debug problems with
accessing the CX23418's PCI memory mapped IO.

Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4519064c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ cx18-objs := cx18-driver.o cx18-cards.o cx18-i2c.o cx18-firmware.o cx18-gpio.
	cx18-queue.o cx18-streams.o cx18-fileops.o cx18-ioctl.o cx18-controls.o \
	cx18-mailbox.o cx18-vbi.o cx18-audio.o cx18-video.o cx18-irq.o \
	cx18-av-core.o cx18-av-audio.o cx18-av-firmware.o cx18-av-vbi.o cx18-scb.o \
	cx18-dvb.o
	cx18-dvb.o cx18-io.o

obj-$(CONFIG_VIDEO_CX18) += cx18.o

+3 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
 */

#include "cx18-driver.h"
#include "cx18-io.h"
#include "cx18-i2c.h"
#include "cx18-cards.h"
#include "cx18-audio.h"
@@ -60,10 +61,10 @@ int cx18_audio_set_io(struct cx18 *cx)
	if (err)
		return err;

	val = read_reg(CX18_AUDIO_ENABLE) & ~0x30;
	val = cx18_read_reg(cx, CX18_AUDIO_ENABLE) & ~0x30;
	val |= (audio_input > CX18_AV_AUDIO_SERIAL2) ? 0x20 :
					(audio_input << 4);
	write_reg(val | 0xb00, CX18_AUDIO_ENABLE);
	cx18_write_reg(cx, val | 0xb00, CX18_AUDIO_ENABLE);
	cx18_vapi(cx, CX18_APU_RESETAI, 1, 0);
	return 0;
}
+7 −5
Original line number Diff line number Diff line
@@ -22,27 +22,29 @@
 */

#include "cx18-driver.h"
#include "cx18-io.h"

int cx18_av_write(struct cx18 *cx, u16 addr, u8 value)
{
	u32 x = readl(cx->reg_mem + 0xc40000 + (addr & ~3));
	u32 reg = 0xc40000 + (addr & ~3);
	u32 mask = 0xff;
	int shift = (addr & 3) * 8;
	u32 x = cx18_read_reg(cx, reg);

	x = (x & ~(mask << shift)) | ((u32)value << shift);
	writel(x, cx->reg_mem + 0xc40000 + (addr & ~3));
	cx18_write_reg(cx, x, reg);
	return 0;
}

int cx18_av_write4(struct cx18 *cx, u16 addr, u32 value)
{
	writel(value, cx->reg_mem + 0xc40000 + addr);
	cx18_write_reg(cx, value, 0xc40000 + addr);
	return 0;
}

u8 cx18_av_read(struct cx18 *cx, u16 addr)
{
	u32 x = readl(cx->reg_mem + 0xc40000 + (addr & ~3));
	u32 x = cx18_read_reg(cx, 0xc40000 + (addr & ~3));
	int shift = (addr & 3) * 8;

	return (x >> shift) & 0xff;
@@ -50,7 +52,7 @@ u8 cx18_av_read(struct cx18 *cx, u16 addr)

u32 cx18_av_read4(struct cx18 *cx, u16 addr)
{
	return readl(cx->reg_mem + 0xc40000 + addr);
	return cx18_read_reg(cx, 0xc40000 + addr);
}

int cx18_av_and_or(struct cx18 *cx, u16 addr, unsigned and_mask,
+4 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
 */

#include "cx18-driver.h"
#include "cx18-io.h"
#include <linux/firmware.h>

#define CX18_AUDIO_ENABLE 0xc72014
@@ -119,10 +120,10 @@ int cx18_av_loadfw(struct cx18 *cx)
	   have a name in the spec. */
	cx18_av_write4(cx, 0x09CC, 1);

	v = read_reg(CX18_AUDIO_ENABLE);
	/* If bit 11 is 1 */
	v = cx18_read_reg(cx, CX18_AUDIO_ENABLE);
	/* If bit 11 is 1, clear bit 10 */
	if (v & 0x800)
		write_reg(v & 0xFFFFFBFF, CX18_AUDIO_ENABLE); /* Clear bit 10 */
		cx18_write_reg(cx, v & 0xFFFFFBFF, CX18_AUDIO_ENABLE);

	/* Enable WW auto audio standard detection */
	v = cx18_av_read4(cx, CXADEC_STD_DET_CTL);
+4 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
 */

#include "cx18-driver.h"
#include "cx18-io.h"
#include "cx18-version.h"
#include "cx18-cards.h"
#include "cx18-i2c.h"
@@ -651,7 +652,7 @@ static int __devinit cx18_probe(struct pci_dev *dev,
		goto free_mem;
	}
	cx->reg_mem = cx->enc_mem + CX18_REG_OFFSET;
	devtype = read_reg(0xC72028);
	devtype = cx18_read_reg(cx, 0xC72028);
	switch (devtype & 0xff000000) {
	case 0xff000000:
		CX18_INFO("cx23418 revision %08x (A)\n", devtype);
@@ -897,8 +898,8 @@ static void cx18_remove(struct pci_dev *pci_dev)
		cx18_stop_all_captures(cx);

	/* Interrupts */
	sw1_irq_disable(IRQ_CPU_TO_EPU | IRQ_APU_TO_EPU);
	sw2_irq_disable(IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK);
	cx18_sw1_irq_disable(cx, IRQ_CPU_TO_EPU | IRQ_APU_TO_EPU);
	cx18_sw2_irq_disable(cx, IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK);

	cx18_halt_firmware(cx);

Loading