Skip to content

Commit

Permalink
Merge branch 'topic/cx25821' into patchwork
Browse files Browse the repository at this point in the history
* topic/cx25821: (31 commits)
  [media] cx25821: remove cx25821-audio-upstream.c from the Makefile
  [media] cx25821: replace custom ioctls with write()
  [media] cx25821: drop cx25821-video-upstream-ch2.c/h
  [media] cx25821: add output format ioctls
  [media] cx25821: prepare querycap for output support
  [media] cx25821: group all fmt functions together
  [media] cx25821: setup output nodes correctly
  [media] cx25821: remove references to subdevices that aren't there
  [media] cx25821: remove custom ioctls that duplicate v4l2 ioctls
  [media] cx25821: g/s/try/enum_fmt related fixes and cleanups
  [media] cx25821: switch to v4l2_fh, add event and prio handling
  [media] cx25821: replace resource management functions with fh ownership
  [media] cx25821: move vidq from cx25821_fh to cx25821_channel
  [media] cx25821: remove 'type' field from cx25821_fh
  [media] cx25821: use core locking
  [media] cx25821: remove unnecessary debug messages
  [media] cx25821: remove TRUE/FALSE/STATUS_(UN)SUCCESSFUL defines
  [media] cx25821: convert to the control framework
  [media] cx25821: embed video_device, clean up some kernel log spam
  [media] cx25821: remove bogus dependencies
  ...
  • Loading branch information
Mauro Carvalho Chehab committed Apr 25, 2013
2 parents 966a160 + 486a7a2 commit a5d0568
Show file tree
Hide file tree
Showing 15 changed files with 790 additions and 3,253 deletions.
7 changes: 1 addition & 6 deletions drivers/media/pci/cx25821/Kconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
config VIDEO_CX25821
tristate "Conexant cx25821 support"
depends on DVB_CORE && VIDEO_DEV && PCI && I2C
depends on VIDEO_DEV && PCI && I2C
select I2C_ALGOBIT
select VIDEO_BTCX
select VIDEO_TVEEPROM
depends on RC_CORE
select VIDEOBUF_DVB
select VIDEOBUF_DMA_SG
select VIDEO_CX25840
select VIDEO_CX2341X
---help---
This is a video4linux driver for Conexant 25821 based
TV cards.
Expand Down
7 changes: 1 addition & 6 deletions drivers/media/pci/cx25821/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
cx25821-y := cx25821-core.o cx25821-cards.o cx25821-i2c.o \
cx25821-gpio.o cx25821-medusa-video.o \
cx25821-video.o cx25821-video-upstream.o \
cx25821-video-upstream-ch2.o \
cx25821-audio-upstream.o
cx25821-video.o cx25821-video-upstream.o

obj-$(CONFIG_VIDEO_CX25821) += cx25821.o
obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o

ccflags-y += -Idrivers/media/i2c
ccflags-y += -Idrivers/media/common
ccflags-y += -Idrivers/media/tuners
ccflags-y += -Idrivers/media/dvb-core
ccflags-y += -Idrivers/media/dvb-frontends
81 changes: 27 additions & 54 deletions drivers/media/pci/cx25821/cx25821-alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ do { \
Data type declarations - Can be moded to a header file later
****************************************************************************/

static struct snd_card *snd_cx25821_cards[SNDRV_CARDS];
static int devno;

struct cx25821_audio_buffer {
Expand Down Expand Up @@ -151,7 +150,7 @@ static int _cx25821_start_audio_dma(struct cx25821_audio_dev *chip)
{
struct cx25821_audio_buffer *buf = chip->buf;
struct cx25821_dev *dev = chip->dev;
struct sram_channel *audio_ch =
const struct sram_channel *audio_ch =
&cx25821_sram_channels[AUDIO_SRAM_CHANNEL];
u32 tmp = 0;

Expand Down Expand Up @@ -626,34 +625,6 @@ static DEFINE_PCI_DEVICE_TABLE(cx25821_audio_pci_tbl) = {

MODULE_DEVICE_TABLE(pci, cx25821_audio_pci_tbl);

/*
* Not used in the function snd_cx25821_dev_free so removing
* from the file.
*/
/*
static int snd_cx25821_free(struct cx25821_audio_dev *chip)
{
if (chip->irq >= 0)
free_irq(chip->irq, chip);
cx25821_dev_unregister(chip->dev);
pci_disable_device(chip->pci);
return 0;
}
*/

/*
* Component Destructor
*/
static void snd_cx25821_dev_free(struct snd_card *card)
{
struct cx25821_audio_dev *chip = card->private_data;

/* snd_cx25821_free(chip); */
snd_card_free(chip->card);
}

/*
* Alsa Constructor - Component probe
*/
Expand Down Expand Up @@ -685,7 +656,6 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
strcpy(card->driver, "cx25821");

/* Card "creation" */
card->private_free = snd_cx25821_dev_free;
chip = card->private_data;
spin_lock_init(&chip->reg_lock);

Expand Down Expand Up @@ -729,8 +699,7 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
goto error;
}

snd_cx25821_cards[devno] = card;

dev->card = card;
devno++;
return 0;

Expand All @@ -742,9 +711,31 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
/****************************************************************************
LINUX MODULE INIT
****************************************************************************/

static int cx25821_alsa_exit_callback(struct device *dev, void *data)
{
struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
struct cx25821_dev *cxdev = get_cx25821(v4l2_dev);

snd_card_free(cxdev->card);
return 0;
}

static void cx25821_audio_fini(void)
{
snd_card_free(snd_cx25821_cards[0]);
struct device_driver *drv = driver_find("cx25821", &pci_bus_type);
int ret;

ret = driver_for_each_device(drv, NULL, NULL, cx25821_alsa_exit_callback);
}

static int cx25821_alsa_init_callback(struct device *dev, void *data)
{
struct v4l2_device *v4l2_dev = dev_get_drvdata(dev);
struct cx25821_dev *cxdev = get_cx25821(v4l2_dev);

cx25821_audio_initdev(cxdev);
return 0;
}

/*
Expand All @@ -756,29 +747,11 @@ static void cx25821_audio_fini(void)
*/
static int cx25821_alsa_init(void)
{
struct cx25821_dev *dev = NULL;
struct list_head *list;
struct device_driver *drv = driver_find("cx25821", &pci_bus_type);

mutex_lock(&cx25821_devlist_mutex);
list_for_each(list, &cx25821_devlist) {
dev = list_entry(list, struct cx25821_dev, devlist);
cx25821_audio_initdev(dev);
}
mutex_unlock(&cx25821_devlist_mutex);

if (dev == NULL)
pr_info("ERROR ALSA: no cx25821 cards found\n");

return 0;
return driver_for_each_device(drv, NULL, NULL, cx25821_alsa_init_callback);

}

late_initcall(cx25821_alsa_init);
module_exit(cx25821_audio_fini);

/* ----------------------------------------------------------- */
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
22 changes: 11 additions & 11 deletions drivers/media/pci/cx25821/cx25821-audio-upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static int _intr_msk = FLD_AUD_SRC_RISCI1 | FLD_AUD_SRC_OF |
FLD_AUD_SRC_SYNC | FLD_AUD_SRC_OPC_ERR;

static int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev,
struct sram_channel *ch,
const struct sram_channel *ch,
unsigned int bpl, u32 risc)
{
unsigned int i, lines;
Expand Down Expand Up @@ -106,7 +106,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
int fifo_enable)
{
unsigned int line;
struct sram_channel *sram_ch =
const struct sram_channel *sram_ch =
dev->channels[dev->_audio_upstream_channel].sram_channels;
int offset = 0;

Expand Down Expand Up @@ -215,7 +215,7 @@ static void cx25821_free_memory_audio(struct cx25821_dev *dev)

void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
{
struct sram_channel *sram_ch =
const struct sram_channel *sram_ch =
dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels;
u32 tmp = 0;

Expand Down Expand Up @@ -257,7 +257,7 @@ void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev)
}

static int cx25821_get_audio_data(struct cx25821_dev *dev,
struct sram_channel *sram_ch)
const struct sram_channel *sram_ch)
{
struct file *myfile;
int frame_index_temp = dev->_audioframe_index;
Expand Down Expand Up @@ -352,7 +352,7 @@ static void cx25821_audioups_handler(struct work_struct *work)
}

static int cx25821_openfile_audio(struct cx25821_dev *dev,
struct sram_channel *sram_ch)
const struct sram_channel *sram_ch)
{
struct file *myfile;
int i = 0, j = 0;
Expand Down Expand Up @@ -433,7 +433,7 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,
}

static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
struct sram_channel *sram_ch,
const struct sram_channel *sram_ch,
int bpl)
{
int ret = 0;
Expand Down Expand Up @@ -495,7 +495,7 @@ static int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
{
int i = 0;
u32 int_msk_tmp;
struct sram_channel *channel = dev->channels[chan_num].sram_channels;
const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
dma_addr_t risc_phys_jump_addr;
__le32 *rp;

Expand Down Expand Up @@ -587,7 +587,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
struct cx25821_dev *dev = dev_id;
u32 audio_status;
int handled = 0;
struct sram_channel *sram_ch;
const struct sram_channel *sram_ch;

if (!dev)
return -1;
Expand All @@ -611,7 +611,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
}

static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
struct sram_channel *sram_ch)
const struct sram_channel *sram_ch)
{
int count = 0;
u32 tmp;
Expand All @@ -635,7 +635,7 @@ static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
}

static int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,
struct sram_channel *sram_ch)
const struct sram_channel *sram_ch)
{
u32 tmp = 0;
int err = 0;
Expand Down Expand Up @@ -699,7 +699,7 @@ static int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,

int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
{
struct sram_channel *sram_ch;
const struct sram_channel *sram_ch;
int err = 0;

if (dev->_audio_is_running) {
Expand Down
23 changes: 0 additions & 23 deletions drivers/media/pci/cx25821/cx25821-cards.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <media/cx25840.h>

#include "cx25821.h"
#include "tuner-xc2028.h"

/* board config info */

Expand All @@ -45,28 +42,8 @@ struct cx25821_board cx25821_boards[] = {
.name = "CX25821",
.portb = CX25821_RAW,
.portc = CX25821_264,
.input[0].type = CX25821_VMUX_COMPOSITE,
},

};

const unsigned int cx25821_bcount = ARRAY_SIZE(cx25821_boards);

struct cx25821_subid cx25821_subids[] = {
{
.subvendor = 0x14f1,
.subdevice = 0x0920,
.card = CX25821_BOARD,
},
};

void cx25821_card_setup(struct cx25821_dev *dev)
{
static u8 eeprom[256];

if (dev->i2c_bus[0].i2c_rc == 0) {
dev->i2c_bus[0].i2c_client.addr = 0xa0 >> 1;
tveeprom_read(&dev->i2c_bus[0].i2c_client, eeprom,
sizeof(eeprom));
}
}
Loading

0 comments on commit a5d0568

Please sign in to comment.