Commit b7085c08 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] cx231xx: convert from pr_foo to dev_foo

Replace all pr_foo occurrences by dev_foo, as this is
the recommended way for drivers.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 77e97ba2
......@@ -39,7 +39,6 @@
#include <media/v4l2-event.h>
#include <media/cx2341x.h>
#include <media/tuner.h>
#include <linux/usb.h>
#define CX231xx_FIRM_IMAGE_SIZE 376836
#define CX231xx_FIRM_IMAGE_NAME "v4l-cx23885-enc.fw"
......@@ -988,7 +987,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
IVTV_REG_APU, 0);
if (retval != 0) {
pr_err("%s: Error with mc417_register_write\n", __func__);
dev_err(&dev->udev->dev,
"%s: Error with mc417_register_write\n", __func__);
return -1;
}
......@@ -996,21 +996,25 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
&dev->udev->dev);
if (retval != 0) {
pr_err("ERROR: Hotplug firmware request failed (%s).\n",
dev_err(&dev->udev->dev,
"ERROR: Hotplug firmware request failed (%s).\n",
CX231xx_FIRM_IMAGE_NAME);
pr_err("Please fix your hotplug setup, the board will not work without firmware loaded!\n");
dev_err(&dev->udev->dev,
"Please fix your hotplug setup, the board will not work without firmware loaded!\n");
return -1;
}
if (firmware->size != CX231xx_FIRM_IMAGE_SIZE) {
pr_err("ERROR: Firmware size mismatch (have %zd, expected %d)\n",
dev_err(&dev->udev->dev,
"ERROR: Firmware size mismatch (have %zd, expected %d)\n",
firmware->size, CX231xx_FIRM_IMAGE_SIZE);
release_firmware(firmware);
return -1;
}
if (0 != memcmp(firmware->data, magic, 8)) {
pr_err("ERROR: Firmware magic mismatch, wrong file?\n");
dev_err(&dev->udev->dev,
"ERROR: Firmware magic mismatch, wrong file?\n");
release_firmware(firmware);
return -1;
}
......@@ -1057,7 +1061,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
retval |= mc417_register_write(dev, IVTV_REG_HW_BLOCKS,
IVTV_CMD_HW_BLOCKS_RST);
if (retval < 0) {
pr_err("%s: Error with mc417_register_write\n",
dev_err(&dev->udev->dev,
"%s: Error with mc417_register_write\n",
__func__);
return retval;
}
......@@ -1069,7 +1074,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
retval |= mc417_register_write(dev, IVTV_REG_VPU, value & 0xFFFFFFE8);
if (retval < 0) {
pr_err("%s: Error with mc417_register_write\n",
dev_err(&dev->udev->dev,
"%s: Error with mc417_register_write\n",
__func__);
return retval;
}
......@@ -1117,25 +1123,28 @@ static int cx231xx_initialize_codec(struct cx231xx *dev)
dprintk(2, "%s: PING OK\n", __func__);
retval = cx231xx_load_firmware(dev);
if (retval < 0) {
pr_err("%s: f/w load failed\n", __func__);
dev_err(&dev->udev->dev,
"%s: f/w load failed\n", __func__);
return retval;
}
retval = cx231xx_find_mailbox(dev);
if (retval < 0) {
pr_err("%s: mailbox < 0, error\n",
dev_err(&dev->udev->dev, "%s: mailbox < 0, error\n",
__func__);
return -1;
}
dev->cx23417_mailbox = retval;
retval = cx231xx_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0);
if (retval < 0) {
pr_err("ERROR: cx23417 firmware ping failed!\n");
dev_err(&dev->udev->dev,
"ERROR: cx23417 firmware ping failed!\n");
return -1;
}
retval = cx231xx_api_cmd(dev, CX2341X_ENC_GET_VERSION, 0, 1,
&version);
if (retval < 0) {
pr_err("ERROR: cx23417 firmware get encoder: version failed!\n");
dev_err(&dev->udev->dev,
"ERROR: cx23417 firmware get encoder: version failed!\n");
return -1;
}
dprintk(1, "cx23417 firmware version is 0x%08x\n", version);
......@@ -1416,8 +1425,9 @@ static int bb_buf_prepare(struct videobuf_queue *q,
if (!dev->video_mode.bulk_ctl.num_bufs)
urb_init = 1;
}
/*pr_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n",
urb_init, dev->video_mode.max_pkt_size);*/
dev_dbg(&dev->udev->dev,
"urb_init=%d dev->video_mode.max_pkt_size=%d\n",
urb_init, dev->video_mode.max_pkt_size);
dev->mode_tv = 1;
if (urb_init) {
......
......@@ -22,7 +22,6 @@
#include "cx231xx.h"
#include <linux/kernel.h>
#include <linux/usb.h>
#include <linux/init.h>
#include <linux/sound.h>
#include <linux/spinlock.h>
......@@ -182,8 +181,9 @@ static void cx231xx_audio_isocirq(struct urb *urb)
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status < 0) {
pr_err("resubmit of audio urb failed (error=%i)\n",
status);
dev_err(&dev->udev->dev,
"resubmit of audio urb failed (error=%i)\n",
status);
}
return;
}
......@@ -266,8 +266,9 @@ static void cx231xx_audio_bulkirq(struct urb *urb)
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status < 0) {
pr_err("resubmit of audio urb failed (error=%i)\n",
status);
dev_err(&dev->udev->dev,
"resubmit of audio urb failed (error=%i)\n",
status);
}
return;
}
......@@ -277,7 +278,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
int i, errCode;
int sb_size;
pr_debug("%s: Starting ISO AUDIO transfers\n", __func__);
dev_dbg(&dev->udev->dev,
"%s: Starting ISO AUDIO transfers\n", __func__);
if (dev->state & DEV_DISCONNECTED)
return -ENODEV;
......@@ -295,7 +297,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
urb = usb_alloc_urb(CX231XX_ISO_NUM_AUDIO_PACKETS, GFP_ATOMIC);
if (!urb) {
pr_err("usb_alloc_urb failed!\n");
dev_err(&dev->udev->dev, "usb_alloc_urb failed!\n");
for (j = 0; j < i; j++) {
usb_free_urb(dev->adev.urb[j]);
kfree(dev->adev.transfer_buffer[j]);
......@@ -338,7 +340,8 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
int i, errCode;
int sb_size;
pr_debug("%s: Starting BULK AUDIO transfers\n", __func__);
dev_dbg(&dev->udev->dev,
"%s: Starting BULK AUDIO transfers\n", __func__);
if (dev->state & DEV_DISCONNECTED)
return -ENODEV;
......@@ -356,7 +359,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
if (!urb) {
pr_err("usb_alloc_urb failed!\n");
dev_err(&dev->udev->dev, "usb_alloc_urb failed!\n");
for (j = 0; j < i; j++) {
usb_free_urb(dev->adev.urb[j]);
kfree(dev->adev.transfer_buffer[j]);
......@@ -439,12 +442,14 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
dprintk("opening device and trying to acquire exclusive lock\n");
if (!dev) {
pr_err("BUG: cx231xx can't find device struct. Can't proceed with open\n");
dev_err(&dev->udev->dev,
"BUG: cx231xx can't find device struct. Can't proceed with open\n");
return -ENODEV;
}
if (dev->state & DEV_DISCONNECTED) {
pr_err("Can't open. the device was removed.\n");
dev_err(&dev->udev->dev,
"Can't open. the device was removed.\n");
return -ENODEV;
}
......@@ -457,7 +462,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
mutex_unlock(&dev->lock);
if (ret < 0) {
pr_err("failed to set alternate setting !\n");
dev_err(&dev->udev->dev,
"failed to set alternate setting !\n");
return ret;
}
......@@ -493,7 +499,8 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
/* 1 - 48000 samples per sec */
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
if (ret < 0) {
pr_err("failed to set alternate setting !\n");
dev_err(&dev->udev->dev,
"failed to set alternate setting !\n");
mutex_unlock(&dev->lock);
return ret;
......@@ -661,7 +668,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
return 0;
}
pr_debug("probing for cx231xx non standard usbaudio\n");
dev_dbg(&dev->udev->dev,
"probing for cx231xx non standard usbaudio\n");
err = snd_card_new(&dev->udev->dev, index[devnr], "Cx231xx Audio",
THIS_MODULE, 0, &card);
......@@ -705,7 +713,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
bEndpointAddress;
adev->num_alt = uif->num_altsetting;
pr_info("audio EndPoint Addr 0x%x, Alternate settings: %i\n",
dev_info(&dev->udev->dev,
"audio EndPoint Addr 0x%x, Alternate settings: %i\n",
adev->end_point_addr, adev->num_alt);
adev->alt_max_pkt_size = kmalloc(32 * adev->num_alt, GFP_KERNEL);
......@@ -718,8 +727,9 @@ static int cx231xx_audio_init(struct cx231xx *dev)
wMaxPacketSize);
adev->alt_max_pkt_size[i] =
(tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
pr_debug("audio alternate setting %i, max size= %i\n", i,
adev->alt_max_pkt_size[i]);
dev_dbg(&dev->udev->dev,
"audio alternate setting %i, max size= %i\n", i,
adev->alt_max_pkt_size[i]);
}
return 0;
......
This diff is collapsed.
This diff is collapsed.
......@@ -25,7 +25,6 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <linux/vmalloc.h>
#include <media/v4l2-common.h>
#include <media/tuner.h>
......@@ -228,7 +227,7 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
/* call common vendor command request */
status = cx231xx_send_vendor_cmd(dev, &ven_req);
if (status < 0 && !dev->i2c_scan_running) {
pr_err("%s: failed with status -%d\n",
dev_err(&dev->udev->dev, "%s: failed with status -%d\n",
__func__, status);
}
......@@ -523,7 +522,8 @@ int cx231xx_set_video_alternate(struct cx231xx *dev)
usb_set_interface(dev->udev, usb_interface_index,
dev->video_mode.alt);
if (errCode < 0) {
pr_err("cannot change alt number to %d (error=%i)\n",
dev_err(&dev->udev->dev,
"cannot change alt number to %d (error=%i)\n",
dev->video_mode.alt, errCode);
return errCode;
}
......@@ -598,7 +598,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt)
}
if (alt > 0 && max_pkt_size == 0) {
pr_err("can't change interface %d alt no. to %d: Max. Pkt size = 0\n",
dev_err(&dev->udev->dev,
"can't change interface %d alt no. to %d: Max. Pkt size = 0\n",
usb_interface_index, alt);
/*To workaround error number=-71 on EP0 for videograbber,
need add following codes.*/
......@@ -613,7 +614,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt)
if (usb_interface_index > 0) {
status = usb_set_interface(dev->udev, usb_interface_index, alt);
if (status < 0) {
pr_err("can't change interface %d alt no. to %d (err=%i)\n",
dev_err(&dev->udev->dev,
"can't change interface %d alt no. to %d (err=%i)\n",
usb_interface_index, alt, status);
return status;
}
......@@ -771,8 +773,9 @@ int cx231xx_ep5_bulkout(struct cx231xx *dev, u8 *firmware, u16 size)
buffer, 4096, &actlen, 2000);
if (ret)
pr_err("bulk message failed: %d (%d/%d)", ret,
size, actlen);
dev_err(&dev->udev->dev,
"bulk message failed: %d (%d/%d)", ret,
size, actlen);
else {
errCode = actlen != size ? -1 : 0;
}
......@@ -1008,14 +1011,16 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
dev->video_mode.isoc_ctl.urb =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->video_mode.isoc_ctl.urb) {
pr_err("cannot alloc memory for usb buffers\n");
dev_err(&dev->udev->dev,
"cannot alloc memory for usb buffers\n");
return -ENOMEM;
}
dev->video_mode.isoc_ctl.transfer_buffer =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->video_mode.isoc_ctl.transfer_buffer) {
pr_err("cannot allocate memory for usbtransfer\n");
dev_err(&dev->udev->dev,
"cannot allocate memory for usbtransfer\n");
kfree(dev->video_mode.isoc_ctl.urb);
return -ENOMEM;
}
......@@ -1035,7 +1040,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
for (i = 0; i < dev->video_mode.isoc_ctl.num_bufs; i++) {
urb = usb_alloc_urb(max_packets, GFP_KERNEL);
if (!urb) {
pr_err("cannot alloc isoc_ctl.urb %i\n", i);
dev_err(&dev->udev->dev,
"cannot alloc isoc_ctl.urb %i\n", i);
cx231xx_uninit_isoc(dev);
return -ENOMEM;
}
......@@ -1045,7 +1051,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL,
&urb->transfer_dma);
if (!dev->video_mode.isoc_ctl.transfer_buffer[i]) {
pr_err("unable to allocate %i bytes for transfer buffer %i%s\n",
dev_err(&dev->udev->dev,
"unable to allocate %i bytes for transfer buffer %i%s\n",
sb_size, i,
in_interrupt() ? " while in int" : "");
cx231xx_uninit_isoc(dev);
......@@ -1079,7 +1086,8 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
rc = usb_submit_urb(dev->video_mode.isoc_ctl.urb[i],
GFP_ATOMIC);
if (rc) {
pr_err("submit of urb %i failed (error=%i)\n", i,
dev_err(&dev->udev->dev,
"submit of urb %i failed (error=%i)\n", i,
rc);
cx231xx_uninit_isoc(dev);
return rc;
......@@ -1140,14 +1148,16 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
dev->video_mode.bulk_ctl.urb =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->video_mode.bulk_ctl.urb) {
pr_err("cannot alloc memory for usb buffers\n");
dev_err(&dev->udev->dev,
"cannot alloc memory for usb buffers\n");
return -ENOMEM;
}
dev->video_mode.bulk_ctl.transfer_buffer =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->video_mode.bulk_ctl.transfer_buffer) {
pr_err("cannot allocate memory for usbtransfer\n");
dev_err(&dev->udev->dev,
"cannot allocate memory for usbtransfer\n");
kfree(dev->video_mode.bulk_ctl.urb);
return -ENOMEM;
}
......@@ -1167,7 +1177,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
for (i = 0; i < dev->video_mode.bulk_ctl.num_bufs; i++) {
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) {
pr_err("cannot alloc bulk_ctl.urb %i\n", i);
dev_err(&dev->udev->dev,
"cannot alloc bulk_ctl.urb %i\n", i);
cx231xx_uninit_bulk(dev);
return -ENOMEM;
}
......@@ -1178,7 +1189,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
usb_alloc_coherent(dev->udev, sb_size, GFP_KERNEL,
&urb->transfer_dma);
if (!dev->video_mode.bulk_ctl.transfer_buffer[i]) {
pr_err("unable to allocate %i bytes for transfer buffer %i%s\n",
dev_err(&dev->udev->dev,
"unable to allocate %i bytes for transfer buffer %i%s\n",
sb_size, i,
in_interrupt() ? " while in int" : "");
cx231xx_uninit_bulk(dev);
......@@ -1200,7 +1212,8 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
rc = usb_submit_urb(dev->video_mode.bulk_ctl.urb[i],
GFP_ATOMIC);
if (rc) {
pr_err("submit of urb %i failed (error=%i)\n", i,rc);
dev_err(&dev->udev->dev,
"submit of urb %i failed (error=%i)\n", i, rc);
cx231xx_uninit_bulk(dev);
return rc;
}
......@@ -1303,7 +1316,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
errCode = cx231xx_set_power_mode(dev,
POLARIS_AVMODE_ENXTERNAL_AV);
if (errCode < 0) {
pr_err("%s: Failed to set Power - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: Failed to set Power - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
......@@ -1311,7 +1325,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
errCode = cx231xx_set_power_mode(dev,
POLARIS_AVMODE_ANALOGT_TV);
if (errCode < 0) {
pr_err("%s: Failed to set Power - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: Failed to set Power - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
......@@ -1325,13 +1340,15 @@ int cx231xx_dev_init(struct cx231xx *dev)
/* initialize Colibri block */
errCode = cx231xx_afe_init_super_block(dev, 0x23c);
if (errCode < 0) {
pr_err("%s: cx231xx_afe init super block - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: cx231xx_afe init super block - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
errCode = cx231xx_afe_init_channels(dev);
if (errCode < 0) {
pr_err("%s: cx231xx_afe init channels - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: cx231xx_afe init channels - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
......@@ -1339,7 +1356,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
/* Set DIF in By pass mode */
errCode = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND);
if (errCode < 0) {
pr_err("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: cx231xx_dif set to By pass mode - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
......@@ -1347,7 +1365,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
/* I2S block related functions */
errCode = cx231xx_i2s_blk_initialize(dev);
if (errCode < 0) {
pr_err("%s: cx231xx_i2s block initialize - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: cx231xx_i2s block initialize - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
......@@ -1355,7 +1374,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
/* init control pins */
errCode = cx231xx_init_ctrl_pin_status(dev);
if (errCode < 0) {
pr_err("%s: cx231xx_init ctrl pins - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: cx231xx_init ctrl pins - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
......@@ -1381,7 +1401,8 @@ int cx231xx_dev_init(struct cx231xx *dev)
break;
}
if (errCode < 0) {
pr_err("%s: cx231xx_AGC mode to Analog - errCode [%d]!\n",
dev_err(&dev->udev->dev,
"%s: cx231xx_AGC mode to Analog - errCode [%d]!\n",
__func__, errCode);
return errCode;
}
......@@ -1457,7 +1478,7 @@ int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val,
/* call common vendor command request */
status = cx231xx_send_vendor_cmd(dev, &ven_req);
if (status < 0) {
pr_err("%s: failed with status -%d\n",
dev_err(&dev->udev->dev, "%s: failed with status -%d\n",
__func__, status);
}
......
......@@ -22,7 +22,6 @@
#include "cx231xx.h"
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/usb.h>
#include <media/v4l2-common.h>
#include <media/videobuf-vmalloc.h>
......@@ -265,7 +264,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)
struct cx231xx *dev = dvb->adapter.priv;
if (dev->USE_ISO) {
pr_debug("DVB transfer mode is ISO.\n");
dev_dbg(&dev->udev->dev, "DVB transfer mode is ISO.\n");
cx231xx_set_alt_setting(dev, INDEX_TS1, 4);
rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
if (rc < 0)
......@@ -276,7 +275,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)
dev->ts1_mode.max_pkt_size,
dvb_isoc_copy);
} else {
pr_debug("DVB transfer mode is BULK.\n");
dev_dbg(&dev->udev->dev, "DVB transfer mode is BULK.\n");
cx231xx_set_alt_setting(dev, INDEX_TS1, 0);
rc = cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
if (rc < 0)
......@@ -430,14 +429,17 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev)
if (dops->init != NULL && !dev->xc_fw_load_done) {
pr_debug("Reloading firmware for XC5000\n");
dev_dbg(&dev->udev->dev,
"Reloading firmware for XC5000\n");
status = dops->init(dev->dvb->frontend);
if (status == 0) {
dev->xc_fw_load_done = 1;
pr_debug("XC5000 firmware download completed\n");
dev_dbg(&dev->udev->dev,
"XC5000 firmware download completed\n");
} else {
dev->xc_fw_load_done = 0;
pr_debug("XC5000 firmware download failed !!!\n");
dev_dbg(&dev->udev->dev,
"XC5000 firmware download failed !!!\n");
}
}
......
......@@ -23,7 +23,6 @@
#include "cx231xx.h"
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/usb.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <media/v4l2-common.h>
......@@ -502,18 +501,20 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
memset(&client, 0, sizeof(client));
client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
pr_info("i2c_scan: checking for I2C devices on port=%d ..\n",
dev_info(&dev->udev->dev,
"i2c_scan: checking for I2C devices on port=%d ..\n",
i2c_port);
for (i = 0; i < 128; i++) {
client.addr = i;
rc = i2c_master_recv(&client, &buf, 0);
if (rc < 0)
continue;
pr_info("i2c scan: found device @ 0x%x [%s]\n",
i << 1,
i2c_devs[i] ? i2c_devs[i] : "???");
dev_info(&dev->udev->dev,
"i2c scan: found device @ 0x%x [%s]\n",
i << 1,
i2c_devs[i] ? i2c_devs[i] : "???");
}
pr_info("i2c scan: Completed Checking for I2C devices on port=%d.\n",
dev_info(&dev->udev->dev, "i2c scan: Completed Checking for I2C devices on port=%d.\n",
i2c_port);
dev->i2c_scan_running = false;
......@@ -539,7 +540,8 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
i2c_add_adapter(&bus->i2c_adap);
if (0 != bus->i2c_rc)
pr_warn("i2c bus %d register FAILED\n", bus->nr);
dev_warn(&dev->udev->dev,
"i2c bus %d register FAILED\n", bus->nr);
return bus->i2c_rc;
}
......@@ -582,7 +584,8 @@ int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no)
NULL);
if (!dev->i2c_mux_adap[mux_no])
pr_warn("i2c mux %d register FAILED\n", mux_no);
dev_warn(&dev->udev->dev,
"i2c mux %d register FAILED\n", mux_no);
return 0;
}
......
......@@ -19,7 +19,6 @@
*/
#include "cx231xx.h"
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/bitrev.h>
......
......@@ -703,8 +703,8 @@ int initialize_cx231xx(struct cx231xx *dev)
_current_scenario_idx = INDEX_BUSPOWER_DIF_ONLY;
break;
default:
pr_err("bad config in buspower!!!!\n");
pr_err("config_info=%x\n",
dev_err(&dev->udev->dev,
"bad config in buspower!!!!\nconfig_info=%x\n",
config_info & BUSPOWER_MASK);
return 1;
}
......@@ -768,8 +768,8 @@ int initialize_cx231xx(struct cx231xx *dev)
_current_scenario_idx = INDEX_SELFPOWER_COMPRESSOR;
break;
default:
pr_err("bad senario!!!!!\n");
pr_err("config_info=%x\n",
dev_err(&dev->udev->dev,
"bad senario!!!!!\nconfig_info=%x\n",
config_info & SELFPOWER_MASK);
return -ENODEV;
}
......@@ -781,18 +781,29 @@ int initialize_cx231xx(struct cx231xx *dev)
sizeof(struct pcb_config));
if (pcb_debug) {
pr_info("SC(0x00) register = 0x%x\n", config_info);
pr_info("scenario %d\n",
(dev->current_pcb_config.index) + 1);
pr_info("type=%x\n", dev->current_pcb_config.type);
pr_info("mode=%x\n", dev->current_pcb_config.mode);
pr_info("speed=%x\n", dev->current_pcb_config.speed);
pr_info("ts1_source=%x\n",
dev->current_pcb_config.ts1_source);
pr_info("ts2_source=%x\n",
dev->current_pcb_config.ts2_source);
pr_info("analog_source=%x\n",
dev->current_pcb_config.analog_source);
dev_info(&dev->udev->dev,
"SC(0x00) register = 0x%x\n", config_info);
dev_info(&dev->udev->dev,
"scenario %d\n",
(dev->current_pcb_config.index) + 1);
dev_info(&dev->udev->dev,
"type=%x\n",
dev->current_pcb_config.type);
dev_info(&dev->udev->dev,
"mode=%x\n",
dev->current_pcb_config.mode);
dev_info(&dev->udev->dev,
"speed=%x\n",
dev->current_pcb_config.speed);
dev_info(&dev->udev->dev,
"ts1_source=%x\n",
dev->current_pcb_config.ts1_source);
dev_info(&dev->udev->dev,
"ts2_source=%x\n",
dev->current_pcb_config.ts2_source);
dev_info(&dev->udev->dev,
"analog_source=%x\n",
dev->current_pcb_config.analog_source);
}
return 0;
......
......@@ -25,7 +25,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/bitmap.h>
#include <linux/usb.h>
#include <linux/i2c.h>
#include <linux/mm.h>
#include <linux/mutex.h>
......@@ -69,9 +68,11 @@ static inline void print_err_status(struct cx231xx *dev, int packet, int status)
break;
}
if (packet < 0) {
pr_err("URB status %d [%s].\n", status, errmsg);
dev_err(&dev->udev->dev,
"URB status %d [%s].\n", status, errmsg);
} else {
pr_err("URB packet %d, status %d [%s].\n",
dev_err(&dev->udev->dev,
"URB packet %d, status %d [%s].\n",
packet, status, errmsg);
}
}
......@@ -315,8 +316,8 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
case -ESHUTDOWN:
return;
default: /* error */
pr_err("urb completition error %d.\n",
urb->status);
dev_err(&dev->udev->dev,
"urb completition error %d.\n", urb->status);
break;
}
......@@ -330,7 +331,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)
urb->status = usb_submit_urb(urb, GFP_ATOMIC);
if (urb->status) {
pr_err("urb resubmit failed (error=%i)\n",
dev_err(&dev->udev->dev, "urb resubmit failed (error=%i)\n",
urb->status);
}
}
......@@ -343,7 +344,7 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)
struct urb *urb;
int i;
pr_debug("called cx231xx_uninit_vbi_isoc\n");
dev_dbg(&dev->udev->dev, "called cx231xx_uninit_vbi_isoc\n");
dev->vbi_mode.bulk_ctl.nfields = -1;
for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
......@@ -392,7 +393,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
struct urb *urb;
int rc;
pr_debug("called cx231xx_vbi_isoc\n");
dev_dbg(&dev->udev->dev, "called cx231xx_vbi_isoc\n");
/* De-allocates all pending stuff */
cx231xx_uninit_vbi_isoc(dev);
......@@ -418,14 +419,16 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
dev->vbi_mode.bulk_ctl.urb = kzalloc(sizeof(void *) * num_bufs,
GFP_KERNEL);
if (!dev->vbi_mode.bulk_ctl.urb) {
pr_err("cannot alloc memory for usb buffers\n");
dev_err(&dev->udev->dev,
"cannot alloc memory for usb buffers\n");
return -ENOMEM;
}
dev->vbi_mode.bulk_ctl.transfer_buffer =
kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
if (!dev->vbi_mode.bulk_ctl.transfer_buffer) {
pr_err("cannot allocate memory for usbtransfer\n");
dev_err(&dev->udev->dev,
"cannot allocate memory for usbtransfer\n");
kfree(dev->vbi_mode.bulk_ctl.urb);
return -ENOMEM;
}
......@@ -440,7 +443,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) {
pr_err("cannot alloc bulk_ctl.urb %i\n", i);
dev_err(&dev->udev->dev,
"cannot alloc bulk_ctl.urb %i\n", i);
cx231xx_uninit_vbi_isoc(dev);
return -ENOMEM;
}
......@@ -450,7 +454,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
dev->vbi_mode.bulk_ctl.transfer_buffer[i] =
kzalloc(sb_size, GFP_KERNEL);
if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) {
pr_err("unable to allocate %i bytes for transfer buffer %i%s\n",
dev_err(&dev->udev->dev,
"unable to allocate %i bytes for transfer buffer %i%s\n",
sb_size, i,
in_interrupt() ? " while in int" : "");
cx231xx_uninit_vbi_isoc(dev);
......@@ -469,7 +474,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
for (i = 0; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
rc = usb_submit_urb(dev->vbi_mode.bulk_ctl.urb[i], GFP_ATOMIC);
if (rc) {
pr_err("submit of urb %i failed (error=%i)\n", i, rc);
dev_err(&dev->udev->dev,
"submit of urb %i failed (error=%i)\n", i, rc);
cx231xx_uninit_vbi_isoc(dev);
return rc;
}
......@@ -520,7 +526,7 @@ static inline void vbi_buffer_filled(struct cx231xx *dev,
struct cx231xx_buffer *buf)
{
/* Advice that buffer was filled */
/* pr_debug("[%p/%d] wakeup\n", buf, buf->vb.i); */
/* dev_dbg(&dev->udev->dev, "[%p/%d] wakeup\n", buf, buf->vb.i); */
buf->vb.state = VIDEOBUF_DONE;
buf->vb.field_count++;
......@@ -612,7 +618,7 @@ static inline void get_next_vbi_buf(struct cx231xx_dmaqueue *dma_q,
char *outp;
if (list_empty(&dma_q->active)) {
pr_err("No active queue to serve\n");
dev_err(&dev->udev->dev, "No active queue to serve\n");
dev->vbi_mode.bulk_ctl.buf = NULL;
*buf = NULL;
return;
......
......@@ -28,7 +28,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/bitmap.h>
#include <linux/usb.h>
#include <linux/i2c.h>
#include <linux/mm.h>
#include <linux/mutex.h>
......@@ -737,8 +736,9 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb,
if (!dev->video_mode.bulk_ctl.num_bufs)
urb_init = 1;
}
/*pr_debug("urb_init=%d dev->video_mode.max_pkt_size=%d\n",
urb_init, dev->video_mode.max_pkt_size);*/
dev_dbg(&dev->udev->dev,
"urb_init=%d dev->video_mode.max_pkt_size=%d\n",
urb_init, dev->video_mode.max_pkt_size);
if (urb_init) {
dev->mode_tv = 0;
if (dev->USE_ISO)
......@@ -809,7 +809,7 @@ void video_mux(struct cx231xx *dev, int index)
cx231xx_set_audio_input(dev, dev->ctl_ainput);
pr_debug("video_mux : %d\n", index);
dev_dbg(&dev->udev->dev, "video_mux : %d\n", index);
/* do mode control overrides if required */
cx231xx_do_mode_ctrl_overrides(dev);
......@@ -861,7 +861,7 @@ static void res_free(struct cx231xx_fh *fh)
static int check_dev(struct cx231xx *dev)
{
if (dev->state & DEV_DISCONNECTED) {
pr_err("v4l2 ioctl: device not present\n");
dev_err(&dev->udev->dev, "v4l2 ioctl: device not present\n");
return -ENODEV;
}
return 0;
......@@ -953,12 +953,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
return -EINVAL;
if (videobuf_queue_is_busy(&fh->vb_vidq)) {
pr_err("%s: queue busy\n", __func__);
dev_err(&dev->udev->dev, "%s: queue busy\n", __func__);
return -EBUSY;
}
if (dev->stream_on && !fh->stream_on) {
pr_err("%s: device in use by another fh\n", __func__);
dev_err(&dev->udev->dev,
"%s: device in use by another fh\n", __func__);
return -EBUSY;
}
......@@ -1176,8 +1177,9 @@ int cx231xx_s_frequency(struct file *file, void *priv,
int rc;
u32 if_frequency = 5400000;
pr_debug("Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n",
f->frequency, f->type);
dev_dbg(&dev->udev->dev,
"Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n",
f->frequency, f->type);
rc = check_dev(dev);
if (rc < 0)
......@@ -1212,13 +1214,14 @@ int cx231xx_s_frequency(struct file *file, void *priv,
else if (dev->norm & V4L2_STD_SECAM_LC)
if_frequency = 1250000; /*1.25MHz */
pr_debug("if_frequency is set to %d\n", if_frequency);
dev_dbg(&dev->udev->dev,
"if_frequency is set to %d\n", if_frequency);
cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1);
update_HH_register_after_set_DIF(dev);
}
pr_debug("Set New FREQUENCY to %d\n", f->frequency);
dev_dbg(&dev->udev->dev, "Set New FREQUENCY to %d\n", f->frequency);
return rc;
}
......@@ -1522,7 +1525,8 @@ static int vidioc_s_fmt_vbi_cap(struct file *file, void *priv,
struct cx231xx *dev = fh->dev;
if (dev->vbi_stream_on && !fh->stream_on) {
pr_err("%s device in use by another fh\n", __func__);
dev_err(&dev->udev->dev,
"%s device in use by another fh\n", __func__);
return -EBUSY;
}
return vidioc_try_fmt_vbi_cap(file, priv, f);
......@@ -1641,16 +1645,15 @@ static int cx231xx_v4l2_open(struct file *filp)
#if 0
errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE);
if (errCode < 0) {
pr_err("Device locked on digital mode. Can't open analog\n");
dev_err(&dev->udev->dev,
"Device locked on digital mode. Can't open analog\n");
return -EBUSY;
}
#endif
fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL);
if (!fh) {
pr_err("cx231xx-video.c: Out of memory?!\n");
if (!fh)
return -ENOMEM;
}
if (mutex_lock_interruptible(&dev->lock)) {
kfree(fh);
return -ERESTARTSYS;
......@@ -1734,7 +1737,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
dev->radio_dev = NULL;
}
if (dev->vbi_dev) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n",
video_device_node_name(dev->vbi_dev));
if (video_is_registered(dev->vbi_dev))
video_unregister_device(dev->vbi_dev);
......@@ -1743,7 +1746,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev)
dev->vbi_dev = NULL;
}
if (dev->vdev) {
pr_info("V4L2 device %s deregistered\n",
dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n",
video_device_node_name(dev->vdev));
if (dev->board.has_417)
......@@ -2078,7 +2081,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
{
int ret;
pr_info("v4l2 driver version %s\n", CX231XX_VERSION);
dev_info(&dev->udev->dev, "v4l2 driver version %s\n", CX231XX_VERSION);
/* set default norm */
dev->norm = V4L2_STD_PAL;
......@@ -2116,7 +2119,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
/* allocate and fill video video_device struct */
dev->vdev = cx231xx_vdev_init(dev, &cx231xx_video_template, "video");
if (!dev->vdev) {
pr_err("cannot allocate video_device.\n");
dev_err(&dev->udev->dev, "cannot allocate video_device.\n");
return -ENODEV;
}
......@@ -2125,12 +2128,13 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER,
video_nr[dev->devno]);
if (ret) {
pr_err("unable to register video device (error=%i).\n",
dev_err(&dev->udev->dev,
"unable to register video device (error=%i).\n",
ret);
return ret;
}
pr_info("Registered video device %s [v4l2]\n",
dev_info(&dev->udev->dev, "Registered video device %s [v4l2]\n",
video_device_node_name(dev->vdev));
/* Initialize VBI template */
......@@ -2141,7 +2145,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
dev->vbi_dev = cx231xx_vdev_init(dev, &cx231xx_vbi_template, "vbi");
if (!dev->vbi_dev) {
pr_err("cannot allocate video_device.\n");
dev_err(&dev->udev->dev, "cannot allocate video_device.\n");
return -ENODEV;
}
dev->vbi_dev->ctrl_handler = &dev->ctrl_handler;
......@@ -2149,28 +2153,30 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
vbi_nr[dev->devno]);
if (ret < 0) {
pr_err("unable to register vbi device\n");
dev_err(&dev->udev->dev, "unable to register vbi device\n");
return ret;
}
pr_info("Registered VBI device %s\n",
dev_info(&dev->udev->dev, "Registered VBI device %s\n",
video_device_node_name(dev->vbi_dev));
if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) {
dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template,
"radio");
if (!dev->radio_dev) {
pr_err("cannot allocate video_device.\n");
dev_err(&dev->udev->dev,
"cannot allocate video_device.\n");
return -ENODEV;
}
dev->radio_dev->ctrl_handler = &dev->radio_ctrl_handler;
ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO,
radio_nr[dev->devno]);
if (ret < 0) {
pr_err("can't register radio device\n");
dev_err(&dev->udev->dev,
"can't register radio device\n");
return ret;
}
pr_info("Registered radio device as %s\n",
dev_info(&dev->udev->dev, "Registered radio device as %s\n",
video_device_node_name(dev->radio_dev));
}
......
......@@ -22,14 +22,13 @@
#ifndef _CX231XX_H
#define _CX231XX_H
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/videodev2.h>
#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/i2c.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>
#include <linux/usb.h>
#include <media/cx2341x.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment