Merge branch 'patchwork' into v4l_for_linus

* patchwork: (404 commits)
  [media] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL
  [media] uvcvideo: fix cropcap v4l2-compliance failure
  [media] media: omap3isp: remove unused clkdev
  [media] coda: Add tracing support
  [media] coda: drop dma_sync_single_for_device in coda_bitstream_queue
  [media] coda: fix fill bitstream errors in nonstreaming case
  [media] coda: call SEQ_END when the first queue is stopped
  [media] coda: fail to start streaming if userspace set invalid formats
  [media] coda: remove duplicate error messages for buffer allocations
  [media] coda: move parameter buffer in together with context buffer allocation
  [media] coda: allocate bitstream buffer from REQBUFS, size depends on the format
  [media] coda: allocate per-context buffers from REQBUFS
  [media] coda: use strlcpy instead of snprintf
  [media] coda: bitstream payload is unsigned
  [media] coda: fix double call to debugfs_remove
  [media] coda: check kasprintf return value in coda_open
  [media] coda: bitrate can only be set in kbps steps
  [media] v4l2-mem2mem: no need to initialize b in v4l2_m2m_next_buf and v4l2_m2m_buf_remove
  [media] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init
  [media] coda: set allow_zero_bytesused flag for vb2_queue_init
  ...
This commit is contained in:
Mauro Carvalho Chehab 2015-04-21 06:12:35 -03:00
commit 676ee36be0
464 changed files with 17069 additions and 6386 deletions

View file

@ -87,13 +87,21 @@ config MEDIA_RC_SUPPORT
config MEDIA_CONTROLLER
bool "Media Controller API"
depends on MEDIA_CAMERA_SUPPORT
depends on MEDIA_CAMERA_SUPPORT || MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT
---help---
Enable the media controller API used to query media devices internal
topology and configure it dynamically.
This API is mostly used by camera interfaces in embedded platforms.
config MEDIA_CONTROLLER_DVB
bool "Enable Media controller for DVB"
depends on MEDIA_CONTROLLER
---help---
Enable the media controller API support for DVB.
This is currently experimental.
#
# Video4Linux support
# Only enables if one of the V4L2 types (ATV, webcam, radio) is selected

View file

@ -587,26 +587,20 @@ int saa7146_vv_release(struct saa7146_dev* dev)
}
EXPORT_SYMBOL_GPL(saa7146_vv_release);
int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev,
char *name, int type)
{
struct video_device *vfd;
int err;
int i;
DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type);
// released by vfd->release
vfd = video_device_alloc();
if (vfd == NULL)
return -ENOMEM;
vfd->fops = &video_fops;
if (type == VFL_TYPE_GRABBER)
vfd->ioctl_ops = &dev->ext_vv_data->vid_ops;
else
vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops;
vfd->release = video_device_release;
vfd->release = video_device_release_empty;
vfd->lock = &dev->v4l2_lock;
vfd->v4l2_dev = &dev->v4l2_dev;
vfd->tvnorms = 0;
@ -618,25 +612,20 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
err = video_register_device(vfd, type, -1);
if (err < 0) {
ERR("cannot register v4l2 device. skipping.\n");
video_device_release(vfd);
return err;
}
pr_info("%s: registered device %s [v4l2]\n",
dev->name, video_device_node_name(vfd));
*vid = vfd;
return 0;
}
EXPORT_SYMBOL_GPL(saa7146_register_device);
int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev)
int saa7146_unregister_device(struct video_device *vfd, struct saa7146_dev *dev)
{
DEB_EE("dev:%p\n", dev);
video_unregister_device(*vid);
*vid = NULL;
video_unregister_device(vfd);
return 0;
}
EXPORT_SYMBOL_GPL(saa7146_unregister_device);

View file

@ -95,7 +95,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
/* prepare to wait to be woken up by the irq-handler */
add_wait_queue(&vv->vbi_wq, &wait);
current->state = TASK_INTERRUPTIBLE;
set_current_state(TASK_INTERRUPTIBLE);
/* start rps1 to enable workaround */
saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
@ -106,7 +106,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
DEB_VBI("brs bug workaround %d/1\n", i);
remove_wait_queue(&vv->vbi_wq, &wait);
current->state = TASK_RUNNING;
__set_current_state(TASK_RUNNING);
/* disable rps1 irqs */
SAA7146_IER_DISABLE(dev,MASK_28);

View file

@ -21,10 +21,6 @@
#include "smsir.h"
#include <linux/module.h>
static int sms_dbg;
module_param_named(cards_dbg, sms_dbg, int, 0644);
MODULE_PARM_DESC(cards_dbg, "set debug level (info=1, adv=2 (or-able))");
static struct sms_board sms_boards[] = {
[SMS_BOARD_UNKNOWN] = {
.name = "Unknown board",
@ -232,7 +228,7 @@ int sms_board_event(struct smscore_device_t *coredev,
break; /* BOARD_EVENT_MULTIPLEX_ERRORS */
default:
sms_err("Unknown SMS board event");
pr_err("Unknown SMS board event\n");
break;
}
return 0;
@ -342,7 +338,7 @@ int sms_board_lna_control(struct smscore_device_t *coredev, int onoff)
int board_id = smscore_get_board_id(coredev);
struct sms_board *board = sms_get_board(board_id);
sms_debug("%s: LNA %s", __func__, onoff ? "enabled" : "disabled");
pr_debug("%s: LNA %s\n", __func__, onoff ? "enabled" : "disabled");
switch (board_id) {
case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:

View file

@ -20,8 +20,9 @@
#ifndef __SMS_CARDS_H__
#define __SMS_CARDS_H__
#include <linux/usb.h>
#include "smscoreapi.h"
#include <linux/usb.h>
#include "smsir.h"
#define SMS_BOARD_UNKNOWN 0

View file

@ -21,6 +21,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "smscoreapi.h"
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
@ -34,14 +36,9 @@
#include <linux/wait.h>
#include <asm/byteorder.h>
#include "smscoreapi.h"
#include "sms-cards.h"
#include "smsir.h"
static int sms_dbg;
module_param_named(debug, sms_dbg, int, 0644);
MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))");
struct smscore_device_notifyee_t {
struct list_head entry;
hotplug_t hotplug;
@ -460,7 +457,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath)
strcpy(entry->devpath, devpath);
list_add(&entry->entry, &g_smscore_registry);
} else
sms_err("failed to create smscore_registry.");
pr_err("failed to create smscore_registry.\n");
kmutex_unlock(&g_smscore_registrylock);
return entry;
}
@ -473,7 +470,7 @@ int smscore_registry_getmode(char *devpath)
if (entry)
return entry->mode;
else
sms_err("No registry found.");
pr_err("No registry found.\n");
return default_mode;
}
@ -487,7 +484,7 @@ static enum sms_device_type_st smscore_registry_gettype(char *devpath)
if (entry)
return entry->type;
else
sms_err("No registry found.");
pr_err("No registry found.\n");
return -EINVAL;
}
@ -500,7 +497,7 @@ static void smscore_registry_setmode(char *devpath, int mode)
if (entry)
entry->mode = mode;
else
sms_err("No registry found.");
pr_err("No registry found.\n");
}
static void smscore_registry_settype(char *devpath,
@ -512,7 +509,7 @@ static void smscore_registry_settype(char *devpath,
if (entry)
entry->type = type;
else
sms_err("No registry found.");
pr_err("No registry found.\n");
}
@ -635,10 +632,8 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer,
struct smscore_buffer_t *cb;
cb = kzalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL);
if (!cb) {
sms_info("kzalloc(...) failed");
if (!cb)
return NULL;
}
cb->p = buffer;
cb->offset_in_common = buffer - (u8 *) common_buffer;
@ -658,16 +653,19 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer,
* @return 0 on success, <0 on error.
*/
int smscore_register_device(struct smsdevice_params_t *params,
struct smscore_device_t **coredev)
struct smscore_device_t **coredev,
void *mdev)
{
struct smscore_device_t *dev;
u8 *buffer;
dev = kzalloc(sizeof(struct smscore_device_t), GFP_KERNEL);
if (!dev) {
sms_info("kzalloc(...) failed");
if (!dev)
return -ENOMEM;
}
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
dev->media_dev = mdev;
#endif
/* init list entry so it could be safe in smscore_unregister_device */
INIT_LIST_HEAD(&dev->entry);
@ -722,7 +720,7 @@ int smscore_register_device(struct smsdevice_params_t *params,
smscore_putbuffer(dev, cb);
}
sms_info("allocated %d buffers", dev->num_buffers);
pr_debug("allocated %d buffers\n", dev->num_buffers);
dev->mode = DEVICE_MODE_NONE;
dev->board_id = SMS_BOARD_UNKNOWN;
@ -746,7 +744,7 @@ int smscore_register_device(struct smsdevice_params_t *params,
*coredev = dev;
sms_info("device %p created", dev);
pr_debug("device %p created\n", dev);
return 0;
}
@ -763,7 +761,7 @@ static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev,
rc = coredev->sendrequest_handler(coredev->context, buffer, size);
if (rc < 0) {
sms_info("sendrequest returned error %d", rc);
pr_info("sendrequest returned error %d\n", rc);
return rc;
}
@ -786,11 +784,11 @@ static int smscore_init_ir(struct smscore_device_t *coredev)
coredev->ir.dev = NULL;
ir_io = sms_get_board(smscore_get_board_id(coredev))->board_cfg.ir;
if (ir_io) {/* only if IR port exist we use IR sub-module */
sms_info("IR loading");
pr_debug("IR loading\n");
rc = sms_ir_init(coredev);
if (rc != 0)
sms_err("Error initialization DTV IR sub-module");
pr_err("Error initialization DTV IR sub-module\n");
else {
buffer = kmalloc(sizeof(struct sms_msg_data2) +
SMS_DMA_ALIGNMENT,
@ -812,11 +810,10 @@ static int smscore_init_ir(struct smscore_device_t *coredev)
kfree(buffer);
} else
sms_err
("Sending IR initialization message failed");
pr_err("Sending IR initialization message failed\n");
}
} else
sms_info("IR port has not been detected");
pr_info("IR port has not been detected\n");
return 0;
}
@ -835,13 +832,13 @@ static int smscore_configure_board(struct smscore_device_t *coredev)
board = sms_get_board(coredev->board_id);
if (!board) {
sms_err("no board configuration exist.");
pr_err("no board configuration exist.\n");
return -EINVAL;
}
if (board->mtu) {
struct sms_msg_data mtu_msg;
sms_debug("set max transmit unit %d", board->mtu);
pr_debug("set max transmit unit %d\n", board->mtu);
mtu_msg.x_msg_header.msg_src_id = 0;
mtu_msg.x_msg_header.msg_dst_id = HIF_TASK;
@ -856,7 +853,7 @@ static int smscore_configure_board(struct smscore_device_t *coredev)
if (board->crystal) {
struct sms_msg_data crys_msg;
sms_debug("set crystal value %d", board->crystal);
pr_debug("set crystal value %d\n", board->crystal);
SMS_INIT_MSG(&crys_msg.x_msg_header,
MSG_SMS_NEW_CRYSTAL_REQ,
@ -890,12 +887,12 @@ int smscore_start_device(struct smscore_device_t *coredev)
rc = smscore_set_device_mode(coredev, mode);
if (rc < 0) {
sms_info("set device mode faile , rc %d", rc);
pr_info("set device mode failed , rc %d\n", rc);
return rc;
}
rc = smscore_configure_board(coredev);
if (rc < 0) {
sms_info("configure board failed , rc %d", rc);
pr_info("configure board failed , rc %d\n", rc);
return rc;
}
@ -904,7 +901,7 @@ int smscore_start_device(struct smscore_device_t *coredev)
rc = smscore_notify_callbacks(coredev, coredev->device, 1);
smscore_init_ir(coredev);
sms_info("device %p started, rc %d", coredev, rc);
pr_debug("device %p started, rc %d\n", coredev, rc);
kmutex_unlock(&g_smscore_deviceslock);
@ -927,7 +924,7 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
mem_address = firmware->start_address;
sms_info("loading FW to addr 0x%x size %d",
pr_debug("loading FW to addr 0x%x size %d\n",
mem_address, firmware->length);
if (coredev->preload_handler) {
rc = coredev->preload_handler(coredev->context);
@ -941,14 +938,14 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
return -ENOMEM;
if (coredev->mode != DEVICE_MODE_NONE) {
sms_debug("sending reload command.");
pr_debug("sending reload command.\n");
SMS_INIT_MSG(&msg->x_msg_header, MSG_SW_RELOAD_START_REQ,
sizeof(struct sms_msg_hdr));
rc = smscore_sendrequest_and_wait(coredev, msg,
msg->x_msg_header.msg_length,
&coredev->reload_start_done);
if (rc < 0) {
sms_err("device reload failed, rc %d", rc);
pr_err("device reload failed, rc %d\n", rc);
goto exit_fw_download;
}
mem_address = *(u32 *) &payload[20];
@ -982,7 +979,7 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
if (rc < 0)
goto exit_fw_download;
sms_debug("sending MSG_SMS_DATA_VALIDITY_REQ expecting 0x%x",
pr_debug("sending MSG_SMS_DATA_VALIDITY_REQ expecting 0x%x\n",
calc_checksum);
SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_DATA_VALIDITY_REQ,
sizeof(msg->x_msg_header) +
@ -1001,7 +998,7 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev,
struct sms_msg_data *trigger_msg =
(struct sms_msg_data *) msg;
sms_debug("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ");
pr_debug("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ\n");
SMS_INIT_MSG(&msg->x_msg_header,
MSG_SMS_SWDOWNLOAD_TRIGGER_REQ,
sizeof(struct sms_msg_hdr) +
@ -1037,12 +1034,13 @@ exit_fw_download:
kfree(msg);
if (coredev->postload_handler) {
sms_debug("rc=%d, postload=0x%p", rc, coredev->postload_handler);
pr_debug("rc=%d, postload=0x%p\n",
rc, coredev->postload_handler);
if (rc >= 0)
return coredev->postload_handler(coredev->context);
}
sms_debug("rc=%d", rc);
pr_debug("rc=%d\n", rc);
return rc;
}
@ -1121,11 +1119,11 @@ static char *smscore_get_fw_filename(struct smscore_device_t *coredev,
if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX)
return NULL;
sms_debug("trying to get fw name from sms_boards board_id %d mode %d",
pr_debug("trying to get fw name from sms_boards board_id %d mode %d\n",
board_id, mode);
fw = sms_get_board(board_id)->fw;
if (!fw || !fw[mode]) {
sms_debug("cannot find fw name in sms_boards, getting from lookup table mode %d type %d",
pr_debug("cannot find fw name in sms_boards, getting from lookup table mode %d type %d\n",
mode, type);
return smscore_fw_lkup[type][mode];
}
@ -1154,10 +1152,10 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
char *fw_filename = smscore_get_fw_filename(coredev, mode);
if (!fw_filename) {
sms_err("mode %d not supported on this device", mode);
pr_err("mode %d not supported on this device\n", mode);
return -ENOENT;
}
sms_debug("Firmware name: %s", fw_filename);
pr_debug("Firmware name: %s\n", fw_filename);
if (loadfirmware_handler == NULL && !(coredev->device_flags
& SMS_DEVICE_FAMILY2))
@ -1165,14 +1163,14 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
rc = request_firmware(&fw, fw_filename, coredev->device);
if (rc < 0) {
sms_err("failed to open firmware file \"%s\"", fw_filename);
pr_err("failed to open firmware file '%s'\n", fw_filename);
return rc;
}
sms_info("read fw %s, buffer size=0x%zx", fw_filename, fw->size);
pr_debug("read fw %s, buffer size=0x%zx\n", fw_filename, fw->size);
fw_buf = kmalloc(ALIGN(fw->size, SMS_ALLOC_ALIGNMENT),
GFP_KERNEL | GFP_DMA);
if (!fw_buf) {
sms_err("failed to allocate firmware buffer");
pr_err("failed to allocate firmware buffer\n");
rc = -ENOMEM;
} else {
memcpy(fw_buf, fw->data, fw->size);
@ -1226,18 +1224,18 @@ void smscore_unregister_device(struct smscore_device_t *coredev)
if (num_buffers == coredev->num_buffers)
break;
if (++retry > 10) {
sms_info("exiting although not all buffers released.");
pr_info("exiting although not all buffers released.\n");
break;
}
sms_info("waiting for %d buffer(s)",
pr_debug("waiting for %d buffer(s)\n",
coredev->num_buffers - num_buffers);
kmutex_unlock(&g_smscore_deviceslock);
msleep(100);
kmutex_lock(&g_smscore_deviceslock);
}
sms_info("freed %d buffers", num_buffers);
pr_debug("freed %d buffers\n", num_buffers);
if (coredev->common_buffer)
dma_free_coherent(NULL, coredev->common_buffer_size,
@ -1250,7 +1248,7 @@ void smscore_unregister_device(struct smscore_device_t *coredev)
kmutex_unlock(&g_smscore_deviceslock);
sms_info("device %p destroyed", coredev);
pr_debug("device %p destroyed\n", coredev);
}
EXPORT_SYMBOL_GPL(smscore_unregister_device);
@ -1271,7 +1269,7 @@ static int smscore_detect_mode(struct smscore_device_t *coredev)
rc = smscore_sendrequest_and_wait(coredev, msg, msg->msg_length,
&coredev->version_ex_done);
if (rc == -ETIME) {
sms_err("MSG_SMS_GET_VERSION_EX_REQ failed first try");
pr_err("MSG_SMS_GET_VERSION_EX_REQ failed first try\n");
if (wait_for_completion_timeout(&coredev->resume_done,
msecs_to_jiffies(5000))) {
@ -1279,7 +1277,7 @@ static int smscore_detect_mode(struct smscore_device_t *coredev)
coredev, msg, msg->msg_length,
&coredev->version_ex_done);
if (rc < 0)
sms_err("MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d",
pr_err("MSG_SMS_GET_VERSION_EX_REQ failed second try, rc %d\n",
rc);
} else
rc = -ETIME;
@ -1308,7 +1306,7 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode)
buffer = kmalloc(sizeof(struct sms_msg_data) +
SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA);
if (!buffer) {
sms_err("Could not allocate buffer for init device message.");
pr_err("Could not allocate buffer for init device message.\n");
return -ENOMEM;
}
@ -1339,10 +1337,10 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
{
int rc = 0;
sms_debug("set device mode to %d", mode);
pr_debug("set device mode to %d\n", mode);
if (coredev->device_flags & SMS_DEVICE_FAMILY2) {
if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) {
sms_err("invalid mode specified %d", mode);
pr_err("invalid mode specified %d\n", mode);
return -EINVAL;
}
@ -1351,13 +1349,13 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
if (!(coredev->device_flags & SMS_DEVICE_NOT_READY)) {
rc = smscore_detect_mode(coredev);
if (rc < 0) {
sms_err("mode detect failed %d", rc);
pr_err("mode detect failed %d\n", rc);
return rc;
}
}
if (coredev->mode == mode) {
sms_info("device mode %d already set", mode);
pr_debug("device mode %d already set\n", mode);
return 0;
}
@ -1365,19 +1363,19 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
rc = smscore_load_firmware_from_file(coredev,
mode, NULL);
if (rc >= 0)
sms_info("firmware download success");
pr_debug("firmware download success\n");
} else {
sms_info("mode %d is already supported by running firmware",
pr_debug("mode %d is already supported by running firmware\n",
mode);
}
if (coredev->fw_version >= 0x800) {
rc = smscore_init_device(coredev, mode);
if (rc < 0)
sms_err("device init failed, rc %d.", rc);
pr_err("device init failed, rc %d.\n", rc);
}
} else {
if (mode <= DEVICE_MODE_NONE || mode >= DEVICE_MODE_MAX) {
sms_err("invalid mode specified %d", mode);
pr_err("invalid mode specified %d\n", mode);
return -EINVAL;
}
@ -1414,9 +1412,9 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
}
if (rc < 0)
sms_err("return error code %d.", rc);
pr_err("return error code %d.\n", rc);
else
sms_debug("Success setting device mode.");
pr_debug("Success setting device mode.\n");
return rc;
}
@ -1495,7 +1493,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
last_sample_time = time_now;
if (time_now - last_sample_time > 10000) {
sms_debug("data rate %d bytes/secs",
pr_debug("data rate %d bytes/secs\n",
(int)((data_total * 1000) /
(time_now - last_sample_time)));
@ -1539,7 +1537,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
{
struct sms_version_res *ver =
(struct sms_version_res *) phdr;
sms_debug("Firmware id %d prots 0x%x ver %d.%d",
pr_debug("Firmware id %d prots 0x%x ver %d.%d\n",
ver->firmware_id, ver->supported_protocols,
ver->rom_ver_major, ver->rom_ver_minor);
@ -1562,7 +1560,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
{
struct sms_msg_data *validity = (struct sms_msg_data *) phdr;
sms_debug("MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x",
pr_debug("MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x\n",
validity->msg_data[0]);
complete(&coredev->data_validity_done);
break;
@ -1588,7 +1586,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
{
u32 *msgdata = (u32 *) phdr;
coredev->gpio_get_res = msgdata[1];
sms_debug("gpio level %d",
pr_debug("gpio level %d\n",
coredev->gpio_get_res);
complete(&coredev->gpio_get_level_done);
break;
@ -1615,7 +1613,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
break;
default:
sms_debug("message %s(%d) not handled.",
pr_debug("message %s(%d) not handled.\n",
smscore_translate_msg(phdr->msg_type),
phdr->msg_type);
break;
@ -1681,7 +1679,7 @@ static int smscore_validate_client(struct smscore_device_t *coredev,
struct smscore_client_t *registered_client;
if (!client) {
sms_err("bad parameter.");
pr_err("bad parameter.\n");
return -EINVAL;
}
registered_client = smscore_find_client(coredev, data_type, id);
@ -1689,12 +1687,12 @@ static int smscore_validate_client(struct smscore_device_t *coredev,
return 0;
if (registered_client) {
sms_err("The msg ID already registered to another client.");
pr_err("The msg ID already registered to another client.\n");
return -EEXIST;
}
listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL);
if (!listentry) {
sms_err("Can't allocate memory for client id.");
pr_err("Can't allocate memory for client id.\n");
return -ENOMEM;
}
listentry->id = id;
@ -1726,13 +1724,13 @@ int smscore_register_client(struct smscore_device_t *coredev,
/* check that no other channel with same parameters exists */
if (smscore_find_client(coredev, params->data_type,
params->initial_id)) {
sms_err("Client already exist.");
pr_err("Client already exist.\n");
return -EEXIST;
}
newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL);
if (!newclient) {
sms_err("Failed to allocate memory for client.");
pr_err("Failed to allocate memory for client.\n");
return -ENOMEM;
}
@ -1746,7 +1744,7 @@ int smscore_register_client(struct smscore_device_t *coredev,
smscore_validate_client(coredev, newclient, params->data_type,
params->initial_id);
*client = newclient;
sms_debug("%p %d %d", params->context, params->data_type,
pr_debug("%p %d %d\n", params->context, params->data_type,
params->initial_id);
return 0;
@ -1775,7 +1773,7 @@ void smscore_unregister_client(struct smscore_client_t *client)
kfree(identry);
}
sms_info("%p", client->context);
pr_debug("%p\n", client->context);
list_del(&client->entry);
kfree(client);
@ -1803,7 +1801,7 @@ int smsclient_sendrequest(struct smscore_client_t *client,
int rc;
if (client == NULL) {
sms_err("Got NULL client");
pr_err("Got NULL client\n");
return -EINVAL;
}
@ -1811,7 +1809,7 @@ int smsclient_sendrequest(struct smscore_client_t *client,
/* check that no other channel with same id exists */
if (coredev == NULL) {
sms_err("Got NULL coredev");
pr_err("Got NULL coredev\n");
return -EINVAL;
}
@ -2016,9 +2014,9 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num,
if (rc != 0) {
if (rc == -ETIME)
sms_err("smscore_gpio_configure timeout");
pr_err("smscore_gpio_configure timeout\n");
else
sms_err("smscore_gpio_configure error");
pr_err("smscore_gpio_configure error\n");
}
free:
kfree(buffer);
@ -2065,9 +2063,9 @@ int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 pin_num,
if (rc != 0) {
if (rc == -ETIME)
sms_err("smscore_gpio_set_level timeout");
pr_err("smscore_gpio_set_level timeout\n");
else
sms_err("smscore_gpio_set_level error");
pr_err("smscore_gpio_set_level error\n");
}
kfree(buffer);
@ -2113,9 +2111,9 @@ int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 pin_num,
if (rc != 0) {
if (rc == -ETIME)
sms_err("smscore_gpio_get_level timeout");
pr_err("smscore_gpio_get_level timeout\n");
else
sms_err("smscore_gpio_get_level error");
pr_err("smscore_gpio_get_level error\n");
}
kfree(buffer);
@ -2163,7 +2161,7 @@ static void __exit smscore_module_exit(void)
}
kmutex_unlock(&g_smscore_registrylock);
sms_debug("");
pr_debug("\n");
}
module_init(smscore_module_init);

View file

@ -22,6 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef __SMS_CORE_API_H__
#define __SMS_CORE_API_H__
#define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__
#include <linux/device.h>
#include <linux/list.h>
#include <linux/mm.h>
@ -31,6 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <linux/wait.h>
#include <linux/timer.h>
#include <media/media-device.h>
#include <asm/page.h>
#include "smsir.h"
@ -215,6 +219,10 @@ struct smscore_device_t {
bool is_usb_device;
int led_state;
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
struct media_device *media_dev;
#endif
};
/* GPIO definitions for antenna frequency domain control (SMS8021) */
@ -1115,7 +1123,8 @@ extern int smscore_register_hotplug(hotplug_t hotplug);
extern void smscore_unregister_hotplug(hotplug_t hotplug);
extern int smscore_register_device(struct smsdevice_params_t *params,
struct smscore_device_t **coredev);
struct smscore_device_t **coredev,
void *mdev);
extern void smscore_unregister_device(struct smscore_device_t *coredev);
extern int smscore_start_device(struct smscore_device_t *coredev);
@ -1168,25 +1177,4 @@ int smscore_led_state(struct smscore_device_t *core, int led);
/* ------------------------------------------------------------------------ */
#define DBG_INFO 1
#define DBG_ADV 2
#define sms_printk(kern, fmt, arg...) \
printk(kern "%s: " fmt "\n", __func__, ##arg)
#define dprintk(kern, lvl, fmt, arg...) do {\
if (sms_dbg & lvl) \
sms_printk(kern, fmt, ##arg); \
} while (0)
#define sms_log(fmt, arg...) sms_printk(KERN_INFO, fmt, ##arg)
#define sms_err(fmt, arg...) \
sms_printk(KERN_ERR, "line: %d: " fmt, __LINE__, ##arg)
#define sms_warn(fmt, arg...) sms_printk(KERN_WARNING, fmt, ##arg)
#define sms_info(fmt, arg...) \
dprintk(KERN_INFO, DBG_INFO, fmt, ##arg)
#define sms_debug(fmt, arg...) \
dprintk(KERN_DEBUG, DBG_ADV, fmt, ##arg)
#endif /* __SMS_CORE_API_H__ */

View file

@ -17,7 +17,7 @@
*
***********************************************************************/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include "smscoreapi.h"
#include <linux/module.h>
#include <linux/slab.h>
@ -31,8 +31,6 @@
#include "dvb_demux.h"
#include "dvb_frontend.h"
#include "smscoreapi.h"
#include "smsdvb.h"
static struct dentry *smsdvb_debugfs_usb_root;
@ -536,7 +534,7 @@ int smsdvb_debugfs_register(void)
*/
d = debugfs_create_dir("smsdvb", usb_debug_root);
if (IS_ERR_OR_NULL(d)) {
sms_err("Couldn't create sysfs node for smsdvb");
pr_err("Couldn't create sysfs node for smsdvb\n");
return PTR_ERR(d);
} else {
smsdvb_debugfs_usb_root = d;

View file

@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************/
#include "smscoreapi.h"
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
@ -29,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dvb_demux.h"
#include "dvb_frontend.h"
#include "smscoreapi.h"
#include "sms-cards.h"
#include "smsdvb.h"
@ -39,11 +40,6 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static struct list_head g_smsdvb_clients;
static struct mutex g_smsdvb_clientslock;
static int sms_dbg;
module_param_named(debug, sms_dbg, int, 0644);
MODULE_PARM_DESC(debug, "set debug level (info=1, adv=2 (or-able))");
static u32 sms_to_guard_interval_table[] = {
[0] = GUARD_INTERVAL_1_32,
[1] = GUARD_INTERVAL_1_16,
@ -82,48 +78,48 @@ static void sms_board_dvb3_event(struct smsdvb_client_t *client,
struct smscore_device_t *coredev = client->coredev;
switch (event) {
case DVB3_EVENT_INIT:
sms_debug("DVB3_EVENT_INIT");
pr_debug("DVB3_EVENT_INIT\n");
sms_board_event(coredev, BOARD_EVENT_BIND);
break;
case DVB3_EVENT_SLEEP:
sms_debug("DVB3_EVENT_SLEEP");
pr_debug("DVB3_EVENT_SLEEP\n");
sms_board_event(coredev, BOARD_EVENT_POWER_SUSPEND);
break;
case DVB3_EVENT_HOTPLUG:
sms_debug("DVB3_EVENT_HOTPLUG");
pr_debug("DVB3_EVENT_HOTPLUG\n");
sms_board_event(coredev, BOARD_EVENT_POWER_INIT);
break;
case DVB3_EVENT_FE_LOCK:
if (client->event_fe_state != DVB3_EVENT_FE_LOCK) {
client->event_fe_state = DVB3_EVENT_FE_LOCK;
sms_debug("DVB3_EVENT_FE_LOCK");
pr_debug("DVB3_EVENT_FE_LOCK\n");
sms_board_event(coredev, BOARD_EVENT_FE_LOCK);
}
break;
case DVB3_EVENT_FE_UNLOCK:
if (client->event_fe_state != DVB3_EVENT_FE_UNLOCK) {
client->event_fe_state = DVB3_EVENT_FE_UNLOCK;
sms_debug("DVB3_EVENT_FE_UNLOCK");
pr_debug("DVB3_EVENT_FE_UNLOCK\n");
sms_board_event(coredev, BOARD_EVENT_FE_UNLOCK);
}
break;
case DVB3_EVENT_UNC_OK:
if (client->event_unc_state != DVB3_EVENT_UNC_OK) {
client->event_unc_state = DVB3_EVENT_UNC_OK;
sms_debug("DVB3_EVENT_UNC_OK");
pr_debug("DVB3_EVENT_UNC_OK\n");
sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_OK);
}
break;
case DVB3_EVENT_UNC_ERR:
if (client->event_unc_state != DVB3_EVENT_UNC_ERR) {
client->event_unc_state = DVB3_EVENT_UNC_ERR;
sms_debug("DVB3_EVENT_UNC_ERR");
pr_debug("DVB3_EVENT_UNC_ERR\n");
sms_board_event(coredev, BOARD_EVENT_MULTIPLEX_ERRORS);
}
break;
default:
sms_err("Unknown dvb3 api event");
pr_err("Unknown dvb3 api event\n");
break;
}
}
@ -590,7 +586,7 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
is_status_update = true;
break;
default:
sms_info("message not handled");
pr_debug("message not handled\n");
}
smscore_putbuffer(client->coredev, cb);
@ -613,6 +609,19 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
return 0;
}
static void smsdvb_media_device_unregister(struct smsdvb_client_t *client)
{
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
struct smscore_device_t *coredev = client->coredev;
if (!coredev->media_dev)
return;
media_device_unregister(coredev->media_dev);
kfree(coredev->media_dev);
coredev->media_dev = NULL;
#endif
}
static void smsdvb_unregister_client(struct smsdvb_client_t *client)
{
/* must be called under clientslock */
@ -624,6 +633,7 @@ static void smsdvb_unregister_client(struct smsdvb_client_t *client)
dvb_unregister_frontend(&client->frontend);
dvb_dmxdev_release(&client->dmxdev);
dvb_dmx_release(&client->demux);
smsdvb_media_device_unregister(client);
dvb_unregister_adapter(&client->adapter);
kfree(client);
}
@ -643,7 +653,7 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed)
container_of(feed->demux, struct smsdvb_client_t, demux);
struct sms_msg_data pid_msg;
sms_debug("add pid %d(%x)",
pr_debug("add pid %d(%x)\n",
feed->pid, feed->pid);
client->feed_users++;
@ -665,7 +675,7 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed)
container_of(feed->demux, struct smsdvb_client_t, demux);
struct sms_msg_data pid_msg;
sms_debug("remove pid %d(%x)",
pr_debug("remove pid %d(%x)\n",
feed->pid, feed->pid);
client->feed_users--;
@ -835,7 +845,7 @@ static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *tune)
{
sms_debug("");
pr_debug("\n");
tune->min_delay_ms = 400;
tune->step_size = 250000;
@ -869,7 +879,7 @@ static int smsdvb_dvbt_set_frontend(struct dvb_frontend *fe)
msg.Data[0] = c->frequency;
msg.Data[2] = 12000000;
sms_info("%s: freq %d band %d", __func__, c->frequency,
pr_debug("%s: freq %d band %d\n", __func__, c->frequency,
c->bandwidth_hz);
switch (c->bandwidth_hz / 1000000) {
@ -954,7 +964,7 @@ static int smsdvb_isdbt_set_frontend(struct dvb_frontend *fe)
c->bandwidth_hz = 6000000;
sms_info("%s: freq %d segwidth %d segindex %d", __func__,
pr_debug("freq %d segwidth %d segindex %d\n",
c->frequency, c->isdbt_sb_segment_count,
c->isdbt_sb_segment_idx);
@ -1082,10 +1092,8 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
if (!arrival)
return 0;
client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL);
if (!client) {
sms_err("kmalloc() failed");
if (!client)
return -ENOMEM;
}
/* register dvb adapter */
rc = dvb_register_adapter(&client->adapter,
@ -1093,9 +1101,10 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
smscore_get_board_id(coredev))->name,
THIS_MODULE, device, adapter_nr);
if (rc < 0) {
sms_err("dvb_register_adapter() failed %d", rc);
pr_err("dvb_register_adapter() failed %d\n", rc);
goto adapter_error;
}
dvb_register_media_controller(&client->adapter, coredev->media_dev);
/* init dvb demux */
client->demux.dmx.capabilities = DMX_TS_FILTERING;
@ -1106,7 +1115,7 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
rc = dvb_dmx_init(&client->demux);
if (rc < 0) {
sms_err("dvb_dmx_init failed %d", rc);
pr_err("dvb_dmx_init failed %d\n", rc);
goto dvbdmx_error;
}
@ -1117,7 +1126,7 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
rc = dvb_dmxdev_init(&client->dmxdev, &client->adapter);
if (rc < 0) {
sms_err("dvb_dmxdev_init failed %d", rc);
pr_err("dvb_dmxdev_init failed %d\n", rc);
goto dmxdev_error;
}
@ -1138,7 +1147,7 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
rc = dvb_register_frontend(&client->adapter, &client->frontend);
if (rc < 0) {
sms_err("frontend registration failed %d", rc);
pr_err("frontend registration failed %d\n", rc);
goto frontend_error;
}
@ -1150,7 +1159,7 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
rc = smscore_register_client(coredev, &params, &client->smsclient);
if (rc < 0) {
sms_err("smscore_register_client() failed %d", rc);
pr_err("smscore_register_client() failed %d\n", rc);
goto client_error;
}
@ -1169,12 +1178,14 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,
client->event_unc_state = -1;
sms_board_dvb3_event(client, DVB3_EVENT_HOTPLUG);
sms_info("success");
sms_board_setup(coredev);
if (smsdvb_debugfs_create(client) < 0)
sms_info("failed to create debugfs node");
pr_info("failed to create debugfs node\n");
dvb_create_media_graph(&client->adapter);
pr_info("DVB interface registered.\n");
return 0;
client_error:
@ -1187,6 +1198,7 @@ dmxdev_error:
dvb_dmx_release(&client->demux);
dvbdmx_error:
smsdvb_media_device_unregister(client);
dvb_unregister_adapter(&client->adapter);
adapter_error:
@ -1205,7 +1217,7 @@ static int __init smsdvb_module_init(void)
rc = smscore_register_hotplug(smsdvb_hotplug);
sms_debug("");
pr_debug("\n");
return rc;
}

View file

@ -25,10 +25,11 @@
****************************************************************/
#include "smscoreapi.h"
#include <linux/types.h>
#include <linux/input.h>
#include "smscoreapi.h"
#include "smsir.h"
#include "sms-cards.h"
@ -56,16 +57,14 @@ int sms_ir_init(struct smscore_device_t *coredev)
int board_id = smscore_get_board_id(coredev);
struct rc_dev *dev;
sms_log("Allocating rc device");
pr_debug("Allocating rc device\n");
dev = rc_allocate_device();
if (!dev) {
sms_err("Not enough memory");
if (!dev)
return -ENOMEM;
}
coredev->ir.controller = 0; /* Todo: vega/nova SPI number */
coredev->ir.timeout = IR_DEFAULT_TIMEOUT;
sms_log("IR port %d, timeout %d ms",
pr_debug("IR port %d, timeout %d ms\n",
coredev->ir.controller, coredev->ir.timeout);
snprintf(coredev->ir.name, sizeof(coredev->ir.name),
@ -92,11 +91,12 @@ int sms_ir_init(struct smscore_device_t *coredev)
dev->map_name = sms_get_board(board_id)->rc_codes;
dev->driver_name = MODULE_NAME;
sms_log("Input device (IR) %s is set for key events", dev->input_name);
pr_debug("Input device (IR) %s is set for key events\n",
dev->input_name);
err = rc_register_device(dev);
if (err < 0) {
sms_err("Failed to register device");
pr_err("Failed to register device\n");
rc_free_device(dev);
return err;
}
@ -109,5 +109,5 @@ void sms_ir_exit(struct smscore_device_t *coredev)
{
rc_unregister_device(coredev->ir.dev);
sms_log("");
pr_debug("\n");
}

View file

@ -1136,10 +1136,13 @@ static const struct file_operations dvb_demux_fops = {
.llseek = default_llseek,
};
static struct dvb_device dvbdev_demux = {
static const struct dvb_device dvbdev_demux = {
.priv = NULL,
.users = 1,
.writers = 1,
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
.name = "dvb-demux",
#endif
.fops = &dvb_demux_fops
};
@ -1209,13 +1212,15 @@ static const struct file_operations dvb_dvr_fops = {
.llseek = default_llseek,
};
static struct dvb_device dvbdev_dvr = {
static const struct dvb_device dvbdev_dvr = {
.priv = NULL,
.readers = 1,
.users = 1,
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
.name = "dvb-dvr",
#endif
.fops = &dvb_dvr_fops
};
int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter)
{
int i;

View file

@ -245,6 +245,7 @@
#define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006
#define USB_PID_TECHNOTREND_CONNECT_S2400_8KEEPROM 0x3009
#define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d
#define USB_PID_TECHNOTREND_CONNECT_S2_4600 0x3011
#define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI 0x3012
#define USB_PID_TECHNOTREND_TVSTICK_CT2_4400 0x3014
#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
@ -318,6 +319,7 @@
#define USB_PID_GRANDTEC_DVBT_USB2_COLD 0x0bc6
#define USB_PID_GRANDTEC_DVBT_USB2_WARM 0x0bc7
#define USB_PID_WINFAST_DTV2000DS 0x6a04
#define USB_PID_WINFAST_DTV2000DS_PLUS 0x6f12
#define USB_PID_WINFAST_DTV_DONGLE_COLD 0x6025
#define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026
#define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00
@ -385,4 +387,5 @@
#define USB_PID_PCTV_2002E 0x025c
#define USB_PID_PCTV_2002E_SE 0x025d
#define USB_PID_SVEON_STV27 0xd3af
#define USB_PID_TURBOX_DTT_2000 0xd3a4
#endif

View file

@ -1638,15 +1638,17 @@ static const struct file_operations dvb_ca_fops = {
.llseek = noop_llseek,
};
static struct dvb_device dvbdev_ca = {
static const struct dvb_device dvbdev_ca = {
.priv = NULL,
.users = 1,
.readers = 1,
.writers = 1,
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
.name = "dvb-ca-en50221",
#endif
.fops = &dvb_ca_fops,
};
/* ******************************************************************************** */
/* Initialisation/shutdown functions */
@ -1676,14 +1678,14 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
/* initialise the system data */
if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) {
ret = -ENOMEM;
goto error;
goto exit;
}
ca->pub = pubca;
ca->flags = flags;
ca->slot_count = slot_count;
if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) {
ret = -ENOMEM;
goto error;
goto free_ca;
}
init_waitqueue_head(&ca->wait_queue);
ca->open = 0;
@ -1694,7 +1696,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
/* register the DVB device */
ret = dvb_register_device(dvb_adapter, &ca->dvbdev, &dvbdev_ca, ca, DVB_DEVICE_CA);
if (ret)
goto error;
goto free_slot_info;
/* now initialise each slot */
for (i = 0; i < slot_count; i++) {
@ -1709,7 +1711,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
if (signal_pending(current)) {
ret = -EINTR;
goto error;
goto unregister_device;
}
mb();
@ -1720,17 +1722,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
ret = PTR_ERR(ca->thread);
printk("dvb_ca_init: failed to start kernel_thread (%d)\n",
ret);
goto error;
goto unregister_device;
}
return 0;
error:
if (ca != NULL) {
if (ca->dvbdev != NULL)
dvb_unregister_device(ca->dvbdev);
kfree(ca->slot_info);
kfree(ca);
}
unregister_device:
dvb_unregister_device(ca->dvbdev);
free_slot_info:
kfree(ca->slot_info);
free_ca:
kfree(ca);
exit:
pubca->private = NULL;
return ret;
}

View file

@ -131,6 +131,11 @@ struct dvb_frontend_private {
int quality;
unsigned int check_wrapped;
enum dvbfe_search algo_status;
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
struct media_pipeline pipe;
struct media_entity *pipe_start_entity;
#endif
};
static void dvb_frontend_wakeup(struct dvb_frontend *fe);
@ -590,12 +595,106 @@ static void dvb_frontend_wakeup(struct dvb_frontend *fe)
wake_up_interruptible(&fepriv->wait_queue);
}
/**
* dvb_enable_media_tuner() - tries to enable the DVB tuner
*
* @fe: struct dvb_frontend pointer
*
* This function ensures that just one media tuner is enabled for a given
* frontend. It has two different behaviors:
* - For trivial devices with just one tuner:
* it just enables the existing tuner->fe link
* - For devices with more than one tuner:
* It is up to the driver to implement the logic that will enable one tuner
* and disable the other ones. However, if more than one tuner is enabled for
* the same frontend, it will print an error message and return -EINVAL.
*
* At return, it will return the error code returned by media_entity_setup_link,
* or 0 if everything is OK, if no tuner is linked to the frontend or if the
* mdev is NULL.
*/
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
static int dvb_enable_media_tuner(struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
struct dvb_adapter *adapter = fe->dvb;
struct media_device *mdev = adapter->mdev;
struct media_entity *entity, *source;
struct media_link *link, *found_link = NULL;
int i, ret, n_links = 0, active_links = 0;
fepriv->pipe_start_entity = NULL;
if (!mdev)
return 0;
entity = fepriv->dvbdev->entity;
fepriv->pipe_start_entity = entity;
for (i = 0; i < entity->num_links; i++) {
link = &entity->links[i];
if (link->sink->entity == entity) {
found_link = link;
n_links++;
if (link->flags & MEDIA_LNK_FL_ENABLED)
active_links++;
}
}
if (!n_links || active_links == 1 || !found_link)
return 0;
/*
* If a frontend has more than one tuner linked, it is up to the driver
* to select with one will be the active one, as the frontend core can't
* guess. If the driver doesn't do that, it is a bug.
*/
if (n_links > 1 && active_links != 1) {
dev_err(fe->dvb->device,
"WARNING: there are %d active links among %d tuners. This is a driver's bug!\n",
active_links, n_links);
return -EINVAL;
}
source = found_link->source->entity;
fepriv->pipe_start_entity = source;
for (i = 0; i < source->num_links; i++) {
struct media_entity *sink;
int flags = 0;
link = &source->links[i];
sink = link->sink->entity;
if (sink == entity)
flags = MEDIA_LNK_FL_ENABLED;
ret = media_entity_setup_link(link, flags);
if (ret) {
dev_err(fe->dvb->device,
"Couldn't change link %s->%s to %s. Error %d\n",
source->name, sink->name,
flags ? "enabled" : "disabled",
ret);
return ret;
} else
dev_dbg(fe->dvb->device,
"link %s->%s was %s\n",
source->name, sink->name,
flags ? "ENABLED" : "disabled");
}
return 0;
}
#endif
static int dvb_frontend_thread(void *data)
{
struct dvb_frontend *fe = data;
struct dvb_frontend_private *fepriv = fe->frontend_priv;
fe_status_t s;
enum dvbfe_algo algo;
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
int ret;
#endif
bool re_tune = false;
bool semheld = false;
@ -609,6 +708,20 @@ static int dvb_frontend_thread(void *data)
fepriv->wakeup = 0;
fepriv->reinitialise = 0;
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
ret = dvb_enable_media_tuner(fe);
if (ret) {
/* FIXME: return an error if it fails */
dev_info(fe->dvb->device,
"proceeding with FE task\n");
} else if (fepriv->pipe_start_entity) {
ret = media_entity_pipeline_start(fepriv->pipe_start_entity,
&fepriv->pipe);
if (ret)
return ret;
}
#endif
dvb_frontend_init(fe);
set_freezable();
@ -718,6 +831,12 @@ restart:
}
}
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
if (fepriv->pipe_start_entity)
media_entity_pipeline_stop(fepriv->pipe_start_entity);
fepriv->pipe_start_entity = NULL;
#endif
if (dvb_powerdown_on_sleep) {
if (fe->ops.set_voltage)
fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF);
@ -2612,11 +2731,14 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
struct dvb_frontend* fe)
{
struct dvb_frontend_private *fepriv;
static const struct dvb_device dvbdev_template = {
const struct dvb_device dvbdev_template = {
.users = ~0,
.writers = 1,
.readers = (~0)-1,
.fops = &dvb_frontend_fops,
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
.name = fe->ops.info.name,
#endif
.kernel_ioctl = dvb_frontend_ioctl
};

View file

@ -1462,14 +1462,16 @@ static const struct file_operations dvb_net_fops = {
.llseek = noop_llseek,
};
static struct dvb_device dvbdev_net = {
static const struct dvb_device dvbdev_net = {
.priv = NULL,
.users = 1,
.writers = 1,
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
.name = "dvb-net",
#endif
.fops = &dvb_net_fops,
};
void dvb_net_release (struct dvb_net *dvbnet)
{
int i;

View file

@ -180,6 +180,93 @@ skip:
return -ENFILE;
}
static void dvb_register_media_device(struct dvb_device *dvbdev,
int type, int minor)
{
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
int ret = 0, npads;
if (!dvbdev->adapter->mdev)
return;
dvbdev->entity = kzalloc(sizeof(*dvbdev->entity), GFP_KERNEL);
if (!dvbdev->entity)
return;
dvbdev->entity->info.dev.major = DVB_MAJOR;
dvbdev->entity->info.dev.minor = minor;
dvbdev->entity->name = dvbdev->name;
switch (type) {
case DVB_DEVICE_CA:
case DVB_DEVICE_DEMUX:
case DVB_DEVICE_FRONTEND:
npads = 2;
break;
case DVB_DEVICE_NET:
npads = 0;
break;
default:
npads = 1;
}
if (npads) {
dvbdev->pads = kcalloc(npads, sizeof(*dvbdev->pads),
GFP_KERNEL);
if (!dvbdev->pads) {
kfree(dvbdev->entity);
return;
}
}
switch (type) {
case DVB_DEVICE_FRONTEND:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_FE;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_DEMUX:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_DEMUX;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_DVR:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_DVR;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
break;
case DVB_DEVICE_CA:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_CA;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_NET:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_NET;
break;
default:
kfree(dvbdev->entity);
dvbdev->entity = NULL;
return;
}
if (npads)
ret = media_entity_init(dvbdev->entity, npads, dvbdev->pads, 0);
if (!ret)
ret = media_device_register_entity(dvbdev->adapter->mdev,
dvbdev->entity);
if (ret < 0) {
printk(KERN_ERR
"%s: media_device_register_entity failed for %s\n",
__func__, dvbdev->entity->name);
kfree(dvbdev->pads);
kfree(dvbdev->entity);
dvbdev->entity = NULL;
return;
}
printk(KERN_DEBUG "%s: media device '%s' registered.\n",
__func__, dvbdev->entity->name);
#endif
}
int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
const struct dvb_device *template, void *priv, int type)
@ -258,10 +345,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
__func__, adap->num, dnames[type], id, PTR_ERR(clsdev));
return PTR_ERR(clsdev);
}
dprintk(KERN_DEBUG "DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
adap->num, dnames[type], id, minor, minor);
dvb_register_media_device(dvbdev, type, minor);
return 0;
}
EXPORT_SYMBOL(dvb_register_device);
@ -278,12 +366,66 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
device_destroy(dvb_class, MKDEV(DVB_MAJOR, dvbdev->minor));
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
if (dvbdev->entity) {
media_device_unregister_entity(dvbdev->entity);
kfree(dvbdev->entity);
kfree(dvbdev->pads);
}
#endif
list_del (&dvbdev->list_head);
kfree (dvbdev->fops);
kfree (dvbdev);
}
EXPORT_SYMBOL(dvb_unregister_device);
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
void dvb_create_media_graph(struct dvb_adapter *adap)
{
struct media_device *mdev = adap->mdev;
struct media_entity *entity, *tuner = NULL, *fe = NULL;
struct media_entity *demux = NULL, *dvr = NULL, *ca = NULL;
if (!mdev)
return;
media_device_for_each_entity(entity, mdev) {
switch (entity->type) {
case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
tuner = entity;
break;
case MEDIA_ENT_T_DEVNODE_DVB_FE:
fe = entity;
break;
case MEDIA_ENT_T_DEVNODE_DVB_DEMUX:
demux = entity;
break;
case MEDIA_ENT_T_DEVNODE_DVB_DVR:
dvr = entity;
break;
case MEDIA_ENT_T_DEVNODE_DVB_CA:
ca = entity;
break;
}
}
if (tuner && fe)
media_entity_create_link(tuner, 0, fe, 0, 0);
if (fe && demux)
media_entity_create_link(fe, 1, demux, 0, MEDIA_LNK_FL_ENABLED);
if (demux && dvr)
media_entity_create_link(demux, 1, dvr, 0, MEDIA_LNK_FL_ENABLED);
if (demux && ca)
media_entity_create_link(demux, 1, ca, 0, MEDIA_LNK_FL_ENABLED);
}
EXPORT_SYMBOL_GPL(dvb_create_media_graph);
#endif
static int dvbdev_check_free_adapter_num(int num)
{
struct list_head *entry;

View file

@ -27,6 +27,7 @@
#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/list.h>
#include <media/media-device.h>
#define DVB_MAJOR 212
@ -71,6 +72,10 @@ struct dvb_adapter {
int mfe_shared; /* indicates mutually exclusive frontends */
struct dvb_device *mfe_dvbdev; /* frontend device in use */
struct mutex mfe_lock; /* access lock for thread creation */
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
struct media_device *mdev;
#endif
};
@ -92,6 +97,15 @@ struct dvb_device {
/* don't really need those !? -- FIXME: use video_usercopy */
int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
/* Needed for media controller register/unregister */
#if defined(CONFIG_MEDIA_CONTROLLER_DVB)
const char *name;
/* Allocated and filled inside dvbdev.c */
struct media_entity *entity;
struct media_pad *pads;
#endif
void *priv;
};
@ -109,6 +123,19 @@ extern int dvb_register_device (struct dvb_adapter *adap,
extern void dvb_unregister_device (struct dvb_device *dvbdev);
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
void dvb_create_media_graph(struct dvb_adapter *adap);
static inline void dvb_register_media_controller(struct dvb_adapter *adap,
struct media_device *mdev)
{
adap->mdev = mdev;
}
#else
static inline void dvb_create_media_graph(struct dvb_adapter *adap) {}
#define dvb_register_media_controller(a, b) {}
#endif
extern int dvb_generic_open (struct inode *inode, struct file *file);
extern int dvb_generic_release (struct inode *inode, struct file *file);
extern long dvb_generic_ioctl (struct file *file,

View file

@ -577,6 +577,14 @@ config DVB_LGDT3305
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
config DVB_LGDT3306A
tristate "LG Electronics LGDT3306A based"
depends on DVB_CORE && I2C
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB and QAM-B 64/256 demodulator module. Say Y when you want
to support this frontend.
config DVB_LG2160
tristate "LG Electronics LG216x based"
depends on DVB_CORE && I2C

View file

@ -54,6 +54,7 @@ obj-$(CONFIG_DVB_BCM3510) += bcm3510.o
obj-$(CONFIG_DVB_S5H1420) += s5h1420.o
obj-$(CONFIG_DVB_LGDT330X) += lgdt330x.o
obj-$(CONFIG_DVB_LGDT3305) += lgdt3305.o
obj-$(CONFIG_DVB_LGDT3306A) += lgdt3306a.o
obj-$(CONFIG_DVB_LG2160) += lg2160.o
obj-$(CONFIG_DVB_CX24123) += cx24123.o
obj-$(CONFIG_DVB_LNBP21) += lnbp21.o

View file

@ -27,7 +27,7 @@ struct a8293_config {
u8 i2c_addr;
};
#if IS_ENABLED(CONFIG_DVB_A8293)
#if IS_REACHABLE(CONFIG_DVB_A8293)
extern struct dvb_frontend *a8293_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, const struct a8293_config *cfg);
#else

View file

@ -103,7 +103,7 @@ struct af9013_config {
u8 gpio[4];
};
#if IS_ENABLED(CONFIG_DVB_AF9013)
#if IS_REACHABLE(CONFIG_DVB_AF9013)
extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -61,7 +61,7 @@ struct atbm8830_config {
u8 agc_hold_loop;
};
#if IS_ENABLED(CONFIG_DVB_ATBM8830)
#if IS_REACHABLE(CONFIG_DVB_ATBM8830)
extern struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -61,7 +61,7 @@ struct au8522_config {
enum au8522_if_freq qam_if;
};
#if IS_ENABLED(CONFIG_DVB_AU8522_DTV)
#if IS_REACHABLE(CONFIG_DVB_AU8522_DTV)
extern struct dvb_frontend *au8522_attach(const struct au8522_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -34,7 +34,7 @@ struct bcm3510_config
int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name);
};
#if IS_ENABLED(CONFIG_DVB_BCM3510)
#if IS_REACHABLE(CONFIG_DVB_BCM3510)
extern struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -31,7 +31,7 @@ struct cx22700_config
u8 demod_address;
};
#if IS_ENABLED(CONFIG_DVB_CX22700)
#if IS_REACHABLE(CONFIG_DVB_CX22700)
extern struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -41,7 +41,7 @@ struct cx22702_config {
u8 output_mode;
};
#if IS_ENABLED(CONFIG_DVB_CX22702)
#if IS_REACHABLE(CONFIG_DVB_CX22702)
extern struct dvb_frontend *cx22702_attach(
const struct cx22702_config *config,
struct i2c_adapter *i2c);

View file

@ -46,7 +46,7 @@ static inline int cx24110_pll_write(struct dvb_frontend *fe, u32 val)
return 0;
}
#if IS_ENABLED(CONFIG_DVB_CX24110)
#if IS_REACHABLE(CONFIG_DVB_CX24110)
extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -32,7 +32,7 @@ struct cx24113_config {
u32 xtal_khz;
};
#if IS_ENABLED(CONFIG_DVB_TUNER_CX24113)
#if IS_REACHABLE(CONFIG_DVB_TUNER_CX24113)
extern struct dvb_frontend *cx24113_attach(struct dvb_frontend *,
const struct cx24113_config *config, struct i2c_adapter *i2c);

View file

@ -41,7 +41,7 @@ struct cx24116_config {
u16 i2c_wr_max;
};
#if IS_ENABLED(CONFIG_DVB_CX24116)
#if IS_REACHABLE(CONFIG_DVB_CX24116)
extern struct dvb_frontend *cx24116_attach(
const struct cx24116_config *config,
struct i2c_adapter *i2c);

View file

@ -30,7 +30,7 @@ struct cx24117_config {
u8 demod_address;
};
#if IS_ENABLED(CONFIG_DVB_CX24117)
#if IS_REACHABLE(CONFIG_DVB_CX24117)
extern struct dvb_frontend *cx24117_attach(
const struct cx24117_config *config,
struct i2c_adapter *i2c);

View file

@ -39,7 +39,7 @@ struct cx24123_config {
void (*agc_callback) (struct dvb_frontend *);
};
#if IS_ENABLED(CONFIG_DVB_CX24123)
#if IS_REACHABLE(CONFIG_DVB_CX24123)
extern struct dvb_frontend *cx24123_attach(const struct cx24123_config *config,
struct i2c_adapter *i2c);
extern struct i2c_adapter *cx24123_get_tuner_i2c_adapter(struct dvb_frontend *);

View file

@ -72,7 +72,7 @@ struct cxd2820r_config {
};
#if IS_ENABLED(CONFIG_DVB_CXD2820R)
#if IS_REACHABLE(CONFIG_DVB_CXD2820R)
extern struct dvb_frontend *cxd2820r_attach(
const struct cxd2820r_config *config,
struct i2c_adapter *i2c,

View file

@ -48,7 +48,7 @@ struct dib0070_config {
u8 vga_filter;
};
#if IS_ENABLED(CONFIG_DVB_TUNER_DIB0070)
#if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0070)
extern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg);
extern u16 dib0070_wbd_offset(struct dvb_frontend *);
extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, u8 open);

View file

@ -75,7 +75,7 @@ struct dib0090_config {
u8 force_crystal_mode;
};
#if IS_ENABLED(CONFIG_DVB_TUNER_DIB0090)
#if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0090)
extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config);
extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast);

View file

@ -41,7 +41,7 @@ struct dib_fe_xfer_ops
int (*tuner_pass_ctrl)(struct dvb_frontend *fe, int onoff, u8 pll_ctrl);
};
#if IS_ENABLED(CONFIG_DVB_DIB3000MB)
#if IS_REACHABLE(CONFIG_DVB_DIB3000MB)
extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops);
#else

View file

@ -41,7 +41,7 @@ struct dib3000mc_config {
#define DEFAULT_DIB3000MC_I2C_ADDRESS 16
#define DEFAULT_DIB3000P_I2C_ADDRESS 24
#if IS_ENABLED(CONFIG_DVB_DIB3000MC)
#if IS_REACHABLE(CONFIG_DVB_DIB3000MC)
extern struct dvb_frontend *dib3000mc_attach(struct i2c_adapter *i2c_adap,
u8 i2c_addr,
struct dib3000mc_config *cfg);

View file

@ -40,7 +40,7 @@ struct dib7000m_config {
#define DEFAULT_DIB7000M_I2C_ADDRESS 18
#if IS_ENABLED(CONFIG_DVB_DIB7000M)
#if IS_REACHABLE(CONFIG_DVB_DIB7000M)
extern struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap,
u8 i2c_addr,
struct dib7000m_config *cfg);

View file

@ -66,7 +66,7 @@ struct dib7000p_ops {
struct dvb_frontend *(*init)(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg);
};
#if IS_ENABLED(CONFIG_DVB_DIB7000P)
#if IS_REACHABLE(CONFIG_DVB_DIB7000P)
void *dib7000p_attach(struct dib7000p_ops *ops);
#else
static inline void *dib7000p_attach(struct dib7000p_ops *ops)

View file

@ -63,7 +63,7 @@ struct dib8000_ops {
struct dvb_frontend *(*init)(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg);
};
#if IS_ENABLED(CONFIG_DVB_DIB8000)
#if IS_REACHABLE(CONFIG_DVB_DIB8000)
void *dib8000_attach(struct dib8000_ops *ops);
#else
static inline int dib8000_attach(struct dib8000_ops *ops)

View file

@ -27,7 +27,7 @@ struct dib9000_config {
#define DEFAULT_DIB9000_I2C_ADDRESS 18
#if IS_ENABLED(CONFIG_DVB_DIB9000)
#if IS_REACHABLE(CONFIG_DVB_DIB9000)
extern struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, const struct dib9000_config *cfg);
extern int dib9000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr);
extern struct i2c_adapter *dib9000_get_tuner_interface(struct dvb_frontend *fe);

View file

@ -34,7 +34,7 @@ struct drx39xxj_state {
const struct firmware *fw;
};
#if IS_ENABLED(CONFIG_DVB_DRX39XYJ)
#if IS_REACHABLE(CONFIG_DVB_DRX39XYJ)
struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c);
#else
static inline struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) {

View file

@ -52,7 +52,7 @@ struct drxd_config {
s16(*osc_deviation) (void *priv, s16 dev, int flag);
};
#if IS_ENABLED(CONFIG_DVB_DRXD)
#if IS_REACHABLE(CONFIG_DVB_DRXD)
extern
struct dvb_frontend *drxd_attach(const struct drxd_config *config,
void *priv, struct i2c_adapter *i2c,

View file

@ -51,7 +51,7 @@ struct drxk_config {
int qam_demod_parameter_count;
};
#if IS_ENABLED(CONFIG_DVB_DRXK)
#if IS_REACHABLE(CONFIG_DVB_DRXK)
extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -35,7 +35,7 @@ struct ds3000_config {
void (*set_lock_led)(struct dvb_frontend *fe, int offon);
};
#if IS_ENABLED(CONFIG_DVB_DS3000)
#if IS_REACHABLE(CONFIG_DVB_DS3000)
extern struct dvb_frontend *ds3000_attach(const struct ds3000_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -38,7 +38,7 @@
* @param pll_desc_id dvb_pll_desc to use.
* @return Frontend pointer on success, NULL on failure
*/
#if IS_ENABLED(CONFIG_DVB_PLL)
#if IS_REACHABLE(CONFIG_DVB_PLL)
extern struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe,
int pll_addr,
struct i2c_adapter *i2c,

View file

@ -26,7 +26,7 @@
#include <linux/dvb/frontend.h>
#include "dvb_frontend.h"
#if IS_ENABLED(CONFIG_DVB_DUMMY_FE)
#if IS_REACHABLE(CONFIG_DVB_DUMMY_FE)
extern struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void);
extern struct dvb_frontend* dvb_dummy_fe_qpsk_attach(void);
extern struct dvb_frontend* dvb_dummy_fe_qam_attach(void);

View file

@ -31,7 +31,7 @@ struct ec100_config {
};
#if IS_ENABLED(CONFIG_DVB_EC100)
#if IS_REACHABLE(CONFIG_DVB_EC100)
extern struct dvb_frontend *ec100_attach(const struct ec100_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -51,7 +51,7 @@ struct hd29l2_config {
};
#if IS_ENABLED(CONFIG_DVB_HD29L2)
#if IS_REACHABLE(CONFIG_DVB_HD29L2)
extern struct dvb_frontend *hd29l2_attach(const struct hd29l2_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -55,7 +55,7 @@
#define ISL6405_ENT2 0x20
#define ISL6405_ISEL2 0x40
#if IS_ENABLED(CONFIG_DVB_ISL6405)
#if IS_REACHABLE(CONFIG_DVB_ISL6405)
/* override_set and override_clear control which system register bits (above)
* to always set & clear
*/

View file

@ -39,7 +39,7 @@
#define ISL6421_ISEL1 0x20
#define ISL6421_DCL 0x40
#if IS_ENABLED(CONFIG_DVB_ISL6421)
#if IS_REACHABLE(CONFIG_DVB_ISL6421)
/* override_set and override_clear control which system register bits (above) to always set & clear */
extern struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr,
u8 override_set, u8 override_clear, bool override_tone);

View file

@ -42,7 +42,7 @@ struct isl6423_config {
u8 mod_extern;
};
#if IS_ENABLED(CONFIG_DVB_ISL6423)
#if IS_REACHABLE(CONFIG_DVB_ISL6423)
extern struct dvb_frontend *isl6423_attach(struct dvb_frontend *fe,

View file

@ -29,7 +29,7 @@ struct itd1000_config {
u8 i2c_address;
};
#if IS_ENABLED(CONFIG_DVB_TUNER_ITD1000)
#if IS_REACHABLE(CONFIG_DVB_TUNER_ITD1000)
extern struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct itd1000_config *cfg);
#else
static inline struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct itd1000_config *cfg)

View file

@ -49,7 +49,7 @@ struct ix2505v_config {
};
#if IS_ENABLED(CONFIG_DVB_IX2505V)
#if IS_REACHABLE(CONFIG_DVB_IX2505V)
extern struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
const struct ix2505v_config *config, struct i2c_adapter *i2c);
#else

View file

@ -31,7 +31,7 @@ struct l64781_config
u8 demod_address;
};
#if IS_ENABLED(CONFIG_DVB_L64781)
#if IS_REACHABLE(CONFIG_DVB_L64781)
extern struct dvb_frontend* l64781_attach(const struct l64781_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -67,7 +67,7 @@ struct lg2160_config {
enum lg_chip_type lg_chip;
};
#if IS_ENABLED(CONFIG_DVB_LG2160)
#if IS_REACHABLE(CONFIG_DVB_LG2160)
extern
struct dvb_frontend *lg2160_attach(const struct lg2160_config *config,
struct i2c_adapter *i2c_adap);

View file

@ -80,7 +80,7 @@ struct lgdt3305_config {
enum lgdt_demod_chip_type demod_chip;
};
#if IS_ENABLED(CONFIG_DVB_LGDT3305)
#if IS_REACHABLE(CONFIG_DVB_LGDT3305)
extern
struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config,
struct i2c_adapter *i2c_adap);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,74 @@
/*
* Support for LGDT3306A - 8VSB/QAM-B
*
* Copyright (C) 2013,2014 Fred Richter <frichter@hauppauge.com>
* based on lgdt3305.[ch] by Michael Krufky
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _LGDT3306A_H_
#define _LGDT3306A_H_
#include <linux/i2c.h>
#include "dvb_frontend.h"
enum lgdt3306a_mpeg_mode {
LGDT3306A_MPEG_PARALLEL = 0,
LGDT3306A_MPEG_SERIAL = 1,
};
enum lgdt3306a_tp_clock_edge {
LGDT3306A_TPCLK_RISING_EDGE = 0,
LGDT3306A_TPCLK_FALLING_EDGE = 1,
};
enum lgdt3306a_tp_valid_polarity {
LGDT3306A_TP_VALID_LOW = 0,
LGDT3306A_TP_VALID_HIGH = 1,
};
struct lgdt3306a_config {
u8 i2c_addr;
/* user defined IF frequency in KHz */
u16 qam_if_khz;
u16 vsb_if_khz;
/* disable i2c repeater - 0:repeater enabled 1:repeater disabled */
unsigned int deny_i2c_rptr:1;
/* spectral inversion - 0:disabled 1:enabled */
unsigned int spectral_inversion:1;
enum lgdt3306a_mpeg_mode mpeg_mode;
enum lgdt3306a_tp_clock_edge tpclk_edge;
enum lgdt3306a_tp_valid_polarity tpvalid_polarity;
/* demod clock freq in MHz; 24 or 25 supported */
int xtalMHz;
};
#if IS_REACHABLE(CONFIG_DVB_LGDT3306A)
struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config,
struct i2c_adapter *i2c_adap);
#else
static inline
struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config,
struct i2c_adapter *i2c_adap)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif /* CONFIG_DVB_LGDT3306A */
#endif /* _LGDT3306A_H_ */

View file

@ -52,7 +52,7 @@ struct lgdt330x_config
int clock_polarity_flip;
};
#if IS_ENABLED(CONFIG_DVB_LGDT330X)
#if IS_REACHABLE(CONFIG_DVB_LGDT330X)
extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -31,7 +31,7 @@ struct lgs8gl5_config {
u8 demod_address;
};
#if IS_ENABLED(CONFIG_DVB_LGS8GL5)
#if IS_REACHABLE(CONFIG_DVB_LGS8GL5)
extern struct dvb_frontend *lgs8gl5_attach(
const struct lgs8gl5_config *config, struct i2c_adapter *i2c);
#else

View file

@ -80,7 +80,7 @@ struct lgs8gxx_config {
u8 tuner_address;
};
#if IS_ENABLED(CONFIG_DVB_LGS8GXX)
#if IS_REACHABLE(CONFIG_DVB_LGS8GXX)
extern struct dvb_frontend *lgs8gxx_attach(const struct lgs8gxx_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -37,7 +37,7 @@
#include <linux/dvb/frontend.h>
#if IS_ENABLED(CONFIG_DVB_LNBP21)
#if IS_REACHABLE(CONFIG_DVB_LNBP21)
/* override_set and override_clear control which
system register bits (above) to always set & clear */
extern struct dvb_frontend *lnbh24_attach(struct dvb_frontend *fe,

View file

@ -57,7 +57,7 @@
#include <linux/dvb/frontend.h>
#if IS_ENABLED(CONFIG_DVB_LNBP21)
#if IS_REACHABLE(CONFIG_DVB_LNBP21)
/* override_set and override_clear control which
system register bits (above) to always set & clear */
extern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe,

View file

@ -39,7 +39,7 @@
#include <linux/dvb/frontend.h>
#if IS_ENABLED(CONFIG_DVB_LNBP22)
#if IS_REACHABLE(CONFIG_DVB_LNBP22)
/*
* override_set and override_clear control which system register bits (above)
* to always set & clear

View file

@ -630,7 +630,7 @@ static int m88ds3103_init(struct dvb_frontend *fe)
/* request the firmware, this will block and timeout */
ret = request_firmware(&fw, fw_file, priv->i2c->dev.parent);
if (ret) {
dev_err(&priv->i2c->dev, "%s: firmare file '%s' not found\n",
dev_err(&priv->i2c->dev, "%s: firmware file '%s' not found\n",
KBUILD_MODNAME, fw_file);
goto err;
}

View file

@ -41,7 +41,7 @@ enum {
CALL_IS_READ,
};
#if IS_ENABLED(CONFIG_DVB_M88RS2000)
#if IS_REACHABLE(CONFIG_DVB_M88RS2000)
extern struct dvb_frontend *m88rs2000_attach(
const struct m88rs2000_config *config, struct i2c_adapter *i2c);
#else

View file

@ -33,7 +33,7 @@ struct mb86a16_config {
#if IS_ENABLED(CONFIG_DVB_MB86A16)
#if IS_REACHABLE(CONFIG_DVB_MB86A16)
extern struct dvb_frontend *mb86a16_attach(const struct mb86a16_config *config,
struct i2c_adapter *i2c_adap);

View file

@ -34,7 +34,7 @@ struct mb86a20s_config {
bool is_serial;
};
#if IS_ENABLED(CONFIG_DVB_MB86A20S)
#if IS_REACHABLE(CONFIG_DVB_MB86A20S)
extern struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config,
struct i2c_adapter *i2c);
extern struct i2c_adapter *mb86a20s_get_tuner_i2c_adapter(struct dvb_frontend *);

View file

@ -19,6 +19,16 @@
#include <linux/dvb/frontend.h>
enum ts_clock {
VARIABLE_TS_CLOCK,
FIXED_TS_CLOCK,
};
enum ts_mode {
SERIAL_TS_MODE,
PARALLEL_TS_MODE,
};
struct mn88472_config {
/*
* Max num of bytes given I2C adapter could write at once.
@ -39,6 +49,8 @@ struct mn88472_config {
* Hz
*/
u32 xtal;
int ts_mode;
int ts_clock;
};
#endif

View file

@ -33,6 +33,12 @@ struct mn88473_config {
* DVB frontend.
*/
struct dvb_frontend **fe;
/*
* Xtal frequency.
* Hz
*/
u32 xtal;
};
#endif

View file

@ -36,7 +36,7 @@ struct mt312_config {
unsigned int voltage_inverted:1;
};
#if IS_ENABLED(CONFIG_DVB_MT312)
#if IS_REACHABLE(CONFIG_DVB_MT312)
struct dvb_frontend *mt312_attach(const struct mt312_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -51,7 +51,7 @@ struct mt352_config
int (*demod_init)(struct dvb_frontend* fe);
};
#if IS_ENABLED(CONFIG_DVB_MT352)
#if IS_REACHABLE(CONFIG_DVB_MT352)
extern struct dvb_frontend* mt352_attach(const struct mt352_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -42,7 +42,7 @@ struct nxt200x_config
int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
};
#if IS_ENABLED(CONFIG_DVB_NXT200X)
#if IS_REACHABLE(CONFIG_DVB_NXT200X)
extern struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -33,7 +33,7 @@ struct nxt6000_config
u8 clock_inversion:1;
};
#if IS_ENABLED(CONFIG_DVB_NXT6000)
#if IS_REACHABLE(CONFIG_DVB_NXT6000)
extern struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -34,7 +34,7 @@ struct or51132_config
int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
};
#if IS_ENABLED(CONFIG_DVB_OR51132)
#if IS_REACHABLE(CONFIG_DVB_OR51132)
extern struct dvb_frontend* or51132_attach(const struct or51132_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -37,7 +37,7 @@ struct or51211_config
void (*sleep)(struct dvb_frontend * fe);
};
#if IS_ENABLED(CONFIG_DVB_OR51211)
#if IS_REACHABLE(CONFIG_DVB_OR51211)
extern struct dvb_frontend* or51211_attach(const struct or51211_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -685,7 +685,7 @@ static int rtl2832_read_status(struct dvb_frontend *fe, fe_status_t *status)
struct rtl2832_dev *dev = fe->demodulator_priv;
struct i2c_client *client = dev->client;
int ret;
u32 tmp;
u32 uninitialized_var(tmp);
dev_dbg(&client->dev, "\n");

View file

@ -67,7 +67,7 @@ struct s5h1409_config {
u8 hvr1600_opt;
};
#if IS_ENABLED(CONFIG_DVB_S5H1409)
#if IS_REACHABLE(CONFIG_DVB_S5H1409)
extern struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -69,7 +69,7 @@ struct s5h1411_config {
u8 status_mode;
};
#if IS_ENABLED(CONFIG_DVB_S5H1411)
#if IS_REACHABLE(CONFIG_DVB_S5H1411)
extern struct dvb_frontend *s5h1411_attach(const struct s5h1411_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -40,7 +40,7 @@ struct s5h1420_config
u8 serial_mpeg:1;
};
#if IS_ENABLED(CONFIG_DVB_S5H1420)
#if IS_REACHABLE(CONFIG_DVB_S5H1420)
extern struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config,
struct i2c_adapter *i2c);
extern struct i2c_adapter *s5h1420_get_tuner_i2c_adapter(struct dvb_frontend *fe);

View file

@ -75,7 +75,7 @@ struct s5h1432_config {
u8 status_mode;
};
#if IS_ENABLED(CONFIG_DVB_S5H1432)
#if IS_REACHABLE(CONFIG_DVB_S5H1432)
extern struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -25,7 +25,7 @@ struct s921_config {
u8 demod_address;
};
#if IS_ENABLED(CONFIG_DVB_S921)
#if IS_REACHABLE(CONFIG_DVB_S921)
extern struct dvb_frontend *s921_attach(const struct s921_config *config,
struct i2c_adapter *i2c);
extern struct i2c_adapter *s921_get_tuner_i2c_adapter(struct dvb_frontend *);

View file

@ -505,7 +505,7 @@ static int si2165_upload_firmware(struct si2165_state *state)
/* reset crc */
ret = si2165_writereg8(state, 0x0379, 0x01);
if (ret)
return ret;
goto error;
ret = si2165_upload_firmware_block(state, data, len,
&offset, block_count);

View file

@ -45,7 +45,7 @@ struct si2165_config {
bool inversion;
};
#if IS_ENABLED(CONFIG_DVB_SI2165)
#if IS_REACHABLE(CONFIG_DVB_SI2165)
struct dvb_frontend *si2165_attach(
const struct si2165_config *config,
struct i2c_adapter *i2c);

View file

@ -40,7 +40,7 @@ struct si2168_dev {
bool ts_clock_inv;
};
/* firmare command struct */
/* firmware command struct */
#define SI2168_ARGLEN 30
struct si2168_cmd {
u8 args[SI2168_ARGLEN];

View file

@ -13,7 +13,7 @@ struct si21xx_config {
int min_delay_ms;
};
#if IS_ENABLED(CONFIG_DVB_SI21XX)
#if IS_REACHABLE(CONFIG_DVB_SI21XX)
extern struct dvb_frontend *si21xx_attach(const struct si21xx_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -413,11 +413,8 @@ static int sp2_remove(struct i2c_client *client)
struct sp2 *s = i2c_get_clientdata(client);
dev_dbg(&client->dev, "\n");
sp2_exit(client);
if (s != NULL)
kfree(s);
kfree(s);
return 0;
}

View file

@ -35,7 +35,7 @@ struct sp8870_config
int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name);
};
#if IS_ENABLED(CONFIG_DVB_SP8870)
#if IS_REACHABLE(CONFIG_DVB_SP8870)
extern struct dvb_frontend* sp8870_attach(const struct sp8870_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -17,7 +17,7 @@ struct sp887x_config
int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name);
};
#if IS_ENABLED(CONFIG_DVB_SP887X)
#if IS_REACHABLE(CONFIG_DVB_SP887X)
extern struct dvb_frontend* sp887x_attach(const struct sp887x_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -141,7 +141,7 @@ struct stb0899_config {
int (*tuner_set_rfsiggain)(struct dvb_frontend *fe, u32 rf_gain);
};
#if IS_ENABLED(CONFIG_DVB_STB0899)
#if IS_REACHABLE(CONFIG_DVB_STB0899)
extern struct dvb_frontend *stb0899_attach(struct stb0899_config *config,
struct i2c_adapter *i2c);

View file

@ -35,7 +35,7 @@
* @param i2c i2c adapter to use.
* @return FE pointer on success, NULL on failure.
*/
#if IS_ENABLED(CONFIG_DVB_STB6000)
#if IS_REACHABLE(CONFIG_DVB_STB6000)
extern struct dvb_frontend *stb6000_attach(struct dvb_frontend *fe, int addr,
struct i2c_adapter *i2c);
#else

View file

@ -94,7 +94,7 @@ struct stb6100_state {
u32 reference;
};
#if IS_ENABLED(CONFIG_DVB_STB6100)
#if IS_REACHABLE(CONFIG_DVB_STB6100)
extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
const struct stb6100_config *config,

View file

@ -43,7 +43,7 @@ struct stv0288_config {
int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
};
#if IS_ENABLED(CONFIG_DVB_STV0288)
#if IS_REACHABLE(CONFIG_DVB_STV0288)
extern struct dvb_frontend *stv0288_attach(const struct stv0288_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -42,7 +42,7 @@ struct stv0297_config
u8 stop_during_read:1;
};
#if IS_ENABLED(CONFIG_DVB_STV0297)
#if IS_REACHABLE(CONFIG_DVB_STV0297)
extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config,
struct i2c_adapter* i2c);
#else

View file

@ -95,7 +95,7 @@ struct stv0299_config
int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured);
};
#if IS_ENABLED(CONFIG_DVB_STV0299)
#if IS_REACHABLE(CONFIG_DVB_STV0299)
extern struct dvb_frontend *stv0299_attach(const struct stv0299_config *config,
struct i2c_adapter *i2c);
#else

View file

@ -39,7 +39,7 @@ struct stv0367_config {
int clk_pol;
};
#if IS_ENABLED(CONFIG_DVB_STV0367)
#if IS_REACHABLE(CONFIG_DVB_STV0367)
extern struct
dvb_frontend *stv0367ter_attach(const struct stv0367_config *config,
struct i2c_adapter *i2c);

View file

@ -58,7 +58,7 @@ struct stv0900_config {
void (*set_lock_led)(struct dvb_frontend *fe, int offon);
};
#if IS_ENABLED(CONFIG_DVB_STV0900)
#if IS_REACHABLE(CONFIG_DVB_STV0900)
extern struct dvb_frontend *stv0900_attach(const struct stv0900_config *config,
struct i2c_adapter *i2c, int demod);
#else

View file

@ -107,7 +107,7 @@ struct stv090x_config {
u8 xor_value);
};
#if IS_ENABLED(CONFIG_DVB_STV090x)
#if IS_REACHABLE(CONFIG_DVB_STV090x)
struct dvb_frontend *stv090x_attach(struct stv090x_config *config,
struct i2c_adapter *i2c,

View file

@ -46,7 +46,7 @@ struct stv6110_config {
u8 clk_div; /* divisor value for the output clock */
};
#if IS_ENABLED(CONFIG_DVB_STV6110)
#if IS_REACHABLE(CONFIG_DVB_STV6110)
extern struct dvb_frontend *stv6110_attach(struct dvb_frontend *fe,
const struct stv6110_config *config,
struct i2c_adapter *i2c);

View file

@ -53,7 +53,7 @@ struct stv6110x_devctl {
};
#if IS_ENABLED(CONFIG_DVB_STV6110x)
#if IS_REACHABLE(CONFIG_DVB_STV6110x)
extern struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
const struct stv6110x_config *config,

Some files were not shown because too many files have changed in this diff Show more