Merge branch 'patchwork' into v4l_for_linus
* patchwork: (496 commits) [media] v4l: tvp5150: Add missing break in set control handler [media] v4l: tvp5150: Don't inline the tvp5150_selmux() function [media] v4l: tvp5150: Compile tvp5150_link_setup out if !CONFIG_MEDIA_CONTROLLER [media] em28xx: don't store usb_device at struct em28xx [media] em28xx: use usb_interface for dev_foo() calls [media] em28xx: don't change the device's name [media] mn88472: fix chip id check on probe [media] mn88473: fix chip id check on probe [media] lirc: fix error paths in lirc_cdev_add() [media] s5p-mfc: Add support for MFC v8 available in Exynos 5433 SoCs [media] s5p-mfc: Rework clock handling [media] s5p-mfc: Don't keep clock prepared all the time [media] s5p-mfc: Kill all IS_ERR_OR_NULL in clocks management code [media] s5p-mfc: Remove dead conditional code [media] s5p-mfc: Ensure that clock is disabled before turning power off [media] s5p-mfc: Remove special clock rate management [media] s5p-mfc: Use printk_ratelimited for reporting ioctl errors [media] s5p-mfc: Set DMA_ATTR_ALLOC_SINGLE_PAGES [media] vivid: Set color_enc on HSV formats [media] v4l2-tpg: Init hv_enc field with a valid value ...
这个提交包含在:
@@ -80,6 +80,22 @@ config MEDIA_RC_SUPPORT
|
||||
|
||||
Say Y when you have a TV or an IR device.
|
||||
|
||||
config MEDIA_CEC_SUPPORT
|
||||
bool "HDMI CEC support"
|
||||
select MEDIA_CEC_EDID
|
||||
---help---
|
||||
Enable support for HDMI CEC (Consumer Electronics Control),
|
||||
which is an optional HDMI feature.
|
||||
|
||||
Say Y when you have an HDMI receiver, transmitter or a USB CEC
|
||||
adapter that supports HDMI CEC.
|
||||
|
||||
config MEDIA_CEC_DEBUG
|
||||
bool "HDMI CEC debugfs interface"
|
||||
depends on MEDIA_CEC_SUPPORT && DEBUG_FS
|
||||
---help---
|
||||
Turns on the DebugFS interface for CEC devices.
|
||||
|
||||
config MEDIA_CEC_EDID
|
||||
bool
|
||||
|
||||
@@ -99,7 +115,7 @@ config MEDIA_CONTROLLER
|
||||
|
||||
config MEDIA_CONTROLLER_DVB
|
||||
bool "Enable Media controller for DVB (EXPERIMENTAL)"
|
||||
depends on MEDIA_CONTROLLER
|
||||
depends on MEDIA_CONTROLLER && DVB_CORE
|
||||
---help---
|
||||
Enable the media controller API support for DVB.
|
||||
|
||||
|
@@ -6,6 +6,10 @@ ifeq ($(CONFIG_MEDIA_CEC_EDID),y)
|
||||
obj-$(CONFIG_MEDIA_SUPPORT) += cec-edid.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
|
||||
obj-$(CONFIG_MEDIA_SUPPORT) += cec/
|
||||
endif
|
||||
|
||||
media-objs := media-device.o media-devnode.o media-entity.o
|
||||
|
||||
#
|
||||
|
5
drivers/media/cec/Makefile
普通文件
5
drivers/media/cec/Makefile
普通文件
@@ -0,0 +1,5 @@
|
||||
cec-objs := cec-core.o cec-adap.o cec-api.o
|
||||
|
||||
ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
|
||||
obj-$(CONFIG_MEDIA_SUPPORT) += cec.o
|
||||
endif
|
1880
drivers/media/cec/cec-adap.c
普通文件
1880
drivers/media/cec/cec-adap.c
普通文件
文件差异内容过多而无法显示
加载差异
588
drivers/media/cec/cec-api.c
普通文件
588
drivers/media/cec/cec-api.c
普通文件
@@ -0,0 +1,588 @@
|
||||
/*
|
||||
* cec-api.c - HDMI Consumer Electronics Control framework - API
|
||||
*
|
||||
* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you may redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#include "cec-priv.h"
|
||||
|
||||
static inline struct cec_devnode *cec_devnode_data(struct file *filp)
|
||||
{
|
||||
struct cec_fh *fh = filp->private_data;
|
||||
|
||||
return &fh->adap->devnode;
|
||||
}
|
||||
|
||||
/* CEC file operations */
|
||||
|
||||
static unsigned int cec_poll(struct file *filp,
|
||||
struct poll_table_struct *poll)
|
||||
{
|
||||
struct cec_devnode *devnode = cec_devnode_data(filp);
|
||||
struct cec_fh *fh = filp->private_data;
|
||||
struct cec_adapter *adap = fh->adap;
|
||||
unsigned int res = 0;
|
||||
|
||||
if (!devnode->registered)
|
||||
return POLLERR | POLLHUP;
|
||||
mutex_lock(&adap->lock);
|
||||
if (adap->is_configured &&
|
||||
adap->transmit_queue_sz < CEC_MAX_MSG_TX_QUEUE_SZ)
|
||||
res |= POLLOUT | POLLWRNORM;
|
||||
if (fh->queued_msgs)
|
||||
res |= POLLIN | POLLRDNORM;
|
||||
if (fh->pending_events)
|
||||
res |= POLLPRI;
|
||||
poll_wait(filp, &fh->wait, poll);
|
||||
mutex_unlock(&adap->lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool cec_is_busy(const struct cec_adapter *adap,
|
||||
const struct cec_fh *fh)
|
||||
{
|
||||
bool valid_initiator = adap->cec_initiator && adap->cec_initiator == fh;
|
||||
bool valid_follower = adap->cec_follower && adap->cec_follower == fh;
|
||||
|
||||
/*
|
||||
* Exclusive initiators and followers can always access the CEC adapter
|
||||
*/
|
||||
if (valid_initiator || valid_follower)
|
||||
return false;
|
||||
/*
|
||||
* All others can only access the CEC adapter if there is no
|
||||
* exclusive initiator and they are in INITIATOR mode.
|
||||
*/
|
||||
return adap->cec_initiator ||
|
||||
fh->mode_initiator == CEC_MODE_NO_INITIATOR;
|
||||
}
|
||||
|
||||
static long cec_adap_g_caps(struct cec_adapter *adap,
|
||||
struct cec_caps __user *parg)
|
||||
{
|
||||
struct cec_caps caps = {};
|
||||
|
||||
strlcpy(caps.driver, adap->devnode.dev.parent->driver->name,
|
||||
sizeof(caps.driver));
|
||||
strlcpy(caps.name, adap->name, sizeof(caps.name));
|
||||
caps.available_log_addrs = adap->available_log_addrs;
|
||||
caps.capabilities = adap->capabilities;
|
||||
caps.version = LINUX_VERSION_CODE;
|
||||
if (copy_to_user(parg, &caps, sizeof(caps)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cec_adap_g_phys_addr(struct cec_adapter *adap,
|
||||
__u16 __user *parg)
|
||||
{
|
||||
u16 phys_addr;
|
||||
|
||||
mutex_lock(&adap->lock);
|
||||
phys_addr = adap->phys_addr;
|
||||
mutex_unlock(&adap->lock);
|
||||
if (copy_to_user(parg, &phys_addr, sizeof(phys_addr)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cec_adap_s_phys_addr(struct cec_adapter *adap, struct cec_fh *fh,
|
||||
bool block, __u16 __user *parg)
|
||||
{
|
||||
u16 phys_addr;
|
||||
long err;
|
||||
|
||||
if (!(adap->capabilities & CEC_CAP_PHYS_ADDR))
|
||||
return -ENOTTY;
|
||||
if (copy_from_user(&phys_addr, parg, sizeof(phys_addr)))
|
||||
return -EFAULT;
|
||||
|
||||
err = cec_phys_addr_validate(phys_addr, NULL, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
mutex_lock(&adap->lock);
|
||||
if (cec_is_busy(adap, fh))
|
||||
err = -EBUSY;
|
||||
else
|
||||
__cec_s_phys_addr(adap, phys_addr, block);
|
||||
mutex_unlock(&adap->lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
static long cec_adap_g_log_addrs(struct cec_adapter *adap,
|
||||
struct cec_log_addrs __user *parg)
|
||||
{
|
||||
struct cec_log_addrs log_addrs;
|
||||
|
||||
mutex_lock(&adap->lock);
|
||||
log_addrs = adap->log_addrs;
|
||||
if (!adap->is_configured)
|
||||
memset(log_addrs.log_addr, CEC_LOG_ADDR_INVALID,
|
||||
sizeof(log_addrs.log_addr));
|
||||
mutex_unlock(&adap->lock);
|
||||
|
||||
if (copy_to_user(parg, &log_addrs, sizeof(log_addrs)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,
|
||||
bool block, struct cec_log_addrs __user *parg)
|
||||
{
|
||||
struct cec_log_addrs log_addrs;
|
||||
long err = -EBUSY;
|
||||
|
||||
if (!(adap->capabilities & CEC_CAP_LOG_ADDRS))
|
||||
return -ENOTTY;
|
||||
if (copy_from_user(&log_addrs, parg, sizeof(log_addrs)))
|
||||
return -EFAULT;
|
||||
log_addrs.flags &= CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK |
|
||||
CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU |
|
||||
CEC_LOG_ADDRS_FL_CDC_ONLY;
|
||||
mutex_lock(&adap->lock);
|
||||
if (!adap->is_configuring &&
|
||||
(!log_addrs.num_log_addrs || !adap->is_configured) &&
|
||||
!cec_is_busy(adap, fh)) {
|
||||
err = __cec_s_log_addrs(adap, &log_addrs, block);
|
||||
if (!err)
|
||||
log_addrs = adap->log_addrs;
|
||||
}
|
||||
mutex_unlock(&adap->lock);
|
||||
if (err)
|
||||
return err;
|
||||
if (copy_to_user(parg, &log_addrs, sizeof(log_addrs)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
|
||||
bool block, struct cec_msg __user *parg)
|
||||
{
|
||||
struct cec_msg msg = {};
|
||||
long err = 0;
|
||||
|
||||
if (!(adap->capabilities & CEC_CAP_TRANSMIT))
|
||||
return -ENOTTY;
|
||||
if (copy_from_user(&msg, parg, sizeof(msg)))
|
||||
return -EFAULT;
|
||||
|
||||
/* A CDC-Only device can only send CDC messages */
|
||||
if ((adap->log_addrs.flags & CEC_LOG_ADDRS_FL_CDC_ONLY) &&
|
||||
(msg.len == 1 || msg.msg[1] != CEC_MSG_CDC_MESSAGE))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&adap->lock);
|
||||
if (!adap->is_configured)
|
||||
err = -ENONET;
|
||||
else if (cec_is_busy(adap, fh))
|
||||
err = -EBUSY;
|
||||
else
|
||||
err = cec_transmit_msg_fh(adap, &msg, fh, block);
|
||||
mutex_unlock(&adap->lock);
|
||||
if (err)
|
||||
return err;
|
||||
if (copy_to_user(parg, &msg, sizeof(msg)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Called by CEC_RECEIVE: wait for a message to arrive */
|
||||
static int cec_receive_msg(struct cec_fh *fh, struct cec_msg *msg, bool block)
|
||||
{
|
||||
u32 timeout = msg->timeout;
|
||||
int res;
|
||||
|
||||
do {
|
||||
mutex_lock(&fh->lock);
|
||||
/* Are there received messages queued up? */
|
||||
if (fh->queued_msgs) {
|
||||
/* Yes, return the first one */
|
||||
struct cec_msg_entry *entry =
|
||||
list_first_entry(&fh->msgs,
|
||||
struct cec_msg_entry, list);
|
||||
|
||||
list_del(&entry->list);
|
||||
*msg = entry->msg;
|
||||
kfree(entry);
|
||||
fh->queued_msgs--;
|
||||
mutex_unlock(&fh->lock);
|
||||
/* restore original timeout value */
|
||||
msg->timeout = timeout;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* No, return EAGAIN in non-blocking mode or wait */
|
||||
mutex_unlock(&fh->lock);
|
||||
|
||||
/* Return when in non-blocking mode */
|
||||
if (!block)
|
||||
return -EAGAIN;
|
||||
|
||||
if (msg->timeout) {
|
||||
/* The user specified a timeout */
|
||||
res = wait_event_interruptible_timeout(fh->wait,
|
||||
fh->queued_msgs,
|
||||
msecs_to_jiffies(msg->timeout));
|
||||
if (res == 0)
|
||||
res = -ETIMEDOUT;
|
||||
else if (res > 0)
|
||||
res = 0;
|
||||
} else {
|
||||
/* Wait indefinitely */
|
||||
res = wait_event_interruptible(fh->wait,
|
||||
fh->queued_msgs);
|
||||
}
|
||||
/* Exit on error, otherwise loop to get the new message */
|
||||
} while (!res);
|
||||
return res;
|
||||
}
|
||||
|
||||
static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh,
|
||||
bool block, struct cec_msg __user *parg)
|
||||
{
|
||||
struct cec_msg msg = {};
|
||||
long err = 0;
|
||||
|
||||
if (copy_from_user(&msg, parg, sizeof(msg)))
|
||||
return -EFAULT;
|
||||
mutex_lock(&adap->lock);
|
||||
if (!adap->is_configured && fh->mode_follower < CEC_MODE_MONITOR)
|
||||
err = -ENONET;
|
||||
mutex_unlock(&adap->lock);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = cec_receive_msg(fh, &msg, block);
|
||||
if (err)
|
||||
return err;
|
||||
msg.flags = 0;
|
||||
if (copy_to_user(parg, &msg, sizeof(msg)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cec_dqevent(struct cec_adapter *adap, struct cec_fh *fh,
|
||||
bool block, struct cec_event __user *parg)
|
||||
{
|
||||
struct cec_event *ev = NULL;
|
||||
u64 ts = ~0ULL;
|
||||
unsigned int i;
|
||||
long err = 0;
|
||||
|
||||
mutex_lock(&fh->lock);
|
||||
while (!fh->pending_events && block) {
|
||||
mutex_unlock(&fh->lock);
|
||||
err = wait_event_interruptible(fh->wait, fh->pending_events);
|
||||
if (err)
|
||||
return err;
|
||||
mutex_lock(&fh->lock);
|
||||
}
|
||||
|
||||
/* Find the oldest event */
|
||||
for (i = 0; i < CEC_NUM_EVENTS; i++) {
|
||||
if (fh->pending_events & (1 << (i + 1)) &&
|
||||
fh->events[i].ts <= ts) {
|
||||
ev = &fh->events[i];
|
||||
ts = ev->ts;
|
||||
}
|
||||
}
|
||||
if (!ev) {
|
||||
err = -EAGAIN;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
if (copy_to_user(parg, ev, sizeof(*ev))) {
|
||||
err = -EFAULT;
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
fh->pending_events &= ~(1 << ev->event);
|
||||
|
||||
unlock:
|
||||
mutex_unlock(&fh->lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
static long cec_g_mode(struct cec_adapter *adap, struct cec_fh *fh,
|
||||
u32 __user *parg)
|
||||
{
|
||||
u32 mode = fh->mode_initiator | fh->mode_follower;
|
||||
|
||||
if (copy_to_user(parg, &mode, sizeof(mode)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cec_s_mode(struct cec_adapter *adap, struct cec_fh *fh,
|
||||
u32 __user *parg)
|
||||
{
|
||||
u32 mode;
|
||||
u8 mode_initiator;
|
||||
u8 mode_follower;
|
||||
long err = 0;
|
||||
|
||||
if (copy_from_user(&mode, parg, sizeof(mode)))
|
||||
return -EFAULT;
|
||||
if (mode & ~(CEC_MODE_INITIATOR_MSK | CEC_MODE_FOLLOWER_MSK))
|
||||
return -EINVAL;
|
||||
|
||||
mode_initiator = mode & CEC_MODE_INITIATOR_MSK;
|
||||
mode_follower = mode & CEC_MODE_FOLLOWER_MSK;
|
||||
|
||||
if (mode_initiator > CEC_MODE_EXCL_INITIATOR ||
|
||||
mode_follower > CEC_MODE_MONITOR_ALL)
|
||||
return -EINVAL;
|
||||
|
||||
if (mode_follower == CEC_MODE_MONITOR_ALL &&
|
||||
!(adap->capabilities & CEC_CAP_MONITOR_ALL))
|
||||
return -EINVAL;
|
||||
|
||||
/* Follower modes should always be able to send CEC messages */
|
||||
if ((mode_initiator == CEC_MODE_NO_INITIATOR ||
|
||||
!(adap->capabilities & CEC_CAP_TRANSMIT)) &&
|
||||
mode_follower >= CEC_MODE_FOLLOWER &&
|
||||
mode_follower <= CEC_MODE_EXCL_FOLLOWER_PASSTHRU)
|
||||
return -EINVAL;
|
||||
|
||||
/* Monitor modes require CEC_MODE_NO_INITIATOR */
|
||||
if (mode_initiator && mode_follower >= CEC_MODE_MONITOR)
|
||||
return -EINVAL;
|
||||
|
||||
/* Monitor modes require CAP_NET_ADMIN */
|
||||
if (mode_follower >= CEC_MODE_MONITOR && !capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
mutex_lock(&adap->lock);
|
||||
/*
|
||||
* You can't become exclusive follower if someone else already
|
||||
* has that job.
|
||||
*/
|
||||
if ((mode_follower == CEC_MODE_EXCL_FOLLOWER ||
|
||||
mode_follower == CEC_MODE_EXCL_FOLLOWER_PASSTHRU) &&
|
||||
adap->cec_follower && adap->cec_follower != fh)
|
||||
err = -EBUSY;
|
||||
/*
|
||||
* You can't become exclusive initiator if someone else already
|
||||
* has that job.
|
||||
*/
|
||||
if (mode_initiator == CEC_MODE_EXCL_INITIATOR &&
|
||||
adap->cec_initiator && adap->cec_initiator != fh)
|
||||
err = -EBUSY;
|
||||
|
||||
if (!err) {
|
||||
bool old_mon_all = fh->mode_follower == CEC_MODE_MONITOR_ALL;
|
||||
bool new_mon_all = mode_follower == CEC_MODE_MONITOR_ALL;
|
||||
|
||||
if (old_mon_all != new_mon_all) {
|
||||
if (new_mon_all)
|
||||
err = cec_monitor_all_cnt_inc(adap);
|
||||
else
|
||||
cec_monitor_all_cnt_dec(adap);
|
||||
}
|
||||
}
|
||||
|
||||
if (err) {
|
||||
mutex_unlock(&adap->lock);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (fh->mode_follower == CEC_MODE_FOLLOWER)
|
||||
adap->follower_cnt--;
|
||||
if (mode_follower == CEC_MODE_FOLLOWER)
|
||||
adap->follower_cnt++;
|
||||
if (mode_follower == CEC_MODE_EXCL_FOLLOWER ||
|
||||
mode_follower == CEC_MODE_EXCL_FOLLOWER_PASSTHRU) {
|
||||
adap->passthrough =
|
||||
mode_follower == CEC_MODE_EXCL_FOLLOWER_PASSTHRU;
|
||||
adap->cec_follower = fh;
|
||||
} else if (adap->cec_follower == fh) {
|
||||
adap->passthrough = false;
|
||||
adap->cec_follower = NULL;
|
||||
}
|
||||
if (mode_initiator == CEC_MODE_EXCL_INITIATOR)
|
||||
adap->cec_initiator = fh;
|
||||
else if (adap->cec_initiator == fh)
|
||||
adap->cec_initiator = NULL;
|
||||
fh->mode_initiator = mode_initiator;
|
||||
fh->mode_follower = mode_follower;
|
||||
mutex_unlock(&adap->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long cec_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct cec_devnode *devnode = cec_devnode_data(filp);
|
||||
struct cec_fh *fh = filp->private_data;
|
||||
struct cec_adapter *adap = fh->adap;
|
||||
bool block = !(filp->f_flags & O_NONBLOCK);
|
||||
void __user *parg = (void __user *)arg;
|
||||
|
||||
if (!devnode->registered)
|
||||
return -ENODEV;
|
||||
|
||||
switch (cmd) {
|
||||
case CEC_ADAP_G_CAPS:
|
||||
return cec_adap_g_caps(adap, parg);
|
||||
|
||||
case CEC_ADAP_G_PHYS_ADDR:
|
||||
return cec_adap_g_phys_addr(adap, parg);
|
||||
|
||||
case CEC_ADAP_S_PHYS_ADDR:
|
||||
return cec_adap_s_phys_addr(adap, fh, block, parg);
|
||||
|
||||
case CEC_ADAP_G_LOG_ADDRS:
|
||||
return cec_adap_g_log_addrs(adap, parg);
|
||||
|
||||
case CEC_ADAP_S_LOG_ADDRS:
|
||||
return cec_adap_s_log_addrs(adap, fh, block, parg);
|
||||
|
||||
case CEC_TRANSMIT:
|
||||
return cec_transmit(adap, fh, block, parg);
|
||||
|
||||
case CEC_RECEIVE:
|
||||
return cec_receive(adap, fh, block, parg);
|
||||
|
||||
case CEC_DQEVENT:
|
||||
return cec_dqevent(adap, fh, block, parg);
|
||||
|
||||
case CEC_G_MODE:
|
||||
return cec_g_mode(adap, fh, parg);
|
||||
|
||||
case CEC_S_MODE:
|
||||
return cec_s_mode(adap, fh, parg);
|
||||
|
||||
default:
|
||||
return -ENOTTY;
|
||||
}
|
||||
}
|
||||
|
||||
static int cec_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct cec_devnode *devnode =
|
||||
container_of(inode->i_cdev, struct cec_devnode, cdev);
|
||||
struct cec_adapter *adap = to_cec_adapter(devnode);
|
||||
struct cec_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL);
|
||||
/*
|
||||
* Initial events that are automatically sent when the cec device is
|
||||
* opened.
|
||||
*/
|
||||
struct cec_event ev_state = {
|
||||
.event = CEC_EVENT_STATE_CHANGE,
|
||||
.flags = CEC_EVENT_FL_INITIAL_STATE,
|
||||
};
|
||||
int err;
|
||||
|
||||
if (!fh)
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_LIST_HEAD(&fh->msgs);
|
||||
INIT_LIST_HEAD(&fh->xfer_list);
|
||||
mutex_init(&fh->lock);
|
||||
init_waitqueue_head(&fh->wait);
|
||||
|
||||
fh->mode_initiator = CEC_MODE_INITIATOR;
|
||||
fh->adap = adap;
|
||||
|
||||
err = cec_get_device(devnode);
|
||||
if (err) {
|
||||
kfree(fh);
|
||||
return err;
|
||||
}
|
||||
|
||||
filp->private_data = fh;
|
||||
|
||||
mutex_lock(&devnode->lock);
|
||||
/* Queue up initial state events */
|
||||
ev_state.state_change.phys_addr = adap->phys_addr;
|
||||
ev_state.state_change.log_addr_mask = adap->log_addrs.log_addr_mask;
|
||||
cec_queue_event_fh(fh, &ev_state, 0);
|
||||
|
||||
list_add(&fh->list, &devnode->fhs);
|
||||
mutex_unlock(&devnode->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Override for the release function */
|
||||
static int cec_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct cec_devnode *devnode = cec_devnode_data(filp);
|
||||
struct cec_adapter *adap = to_cec_adapter(devnode);
|
||||
struct cec_fh *fh = filp->private_data;
|
||||
|
||||
mutex_lock(&adap->lock);
|
||||
if (adap->cec_initiator == fh)
|
||||
adap->cec_initiator = NULL;
|
||||
if (adap->cec_follower == fh) {
|
||||
adap->cec_follower = NULL;
|
||||
adap->passthrough = false;
|
||||
}
|
||||
if (fh->mode_follower == CEC_MODE_FOLLOWER)
|
||||
adap->follower_cnt--;
|
||||
if (fh->mode_follower == CEC_MODE_MONITOR_ALL)
|
||||
cec_monitor_all_cnt_dec(adap);
|
||||
mutex_unlock(&adap->lock);
|
||||
|
||||
mutex_lock(&devnode->lock);
|
||||
list_del(&fh->list);
|
||||
mutex_unlock(&devnode->lock);
|
||||
|
||||
/* Unhook pending transmits from this filehandle. */
|
||||
mutex_lock(&adap->lock);
|
||||
while (!list_empty(&fh->xfer_list)) {
|
||||
struct cec_data *data =
|
||||
list_first_entry(&fh->xfer_list, struct cec_data, xfer_list);
|
||||
|
||||
data->blocking = false;
|
||||
data->fh = NULL;
|
||||
list_del(&data->xfer_list);
|
||||
}
|
||||
mutex_unlock(&adap->lock);
|
||||
while (!list_empty(&fh->msgs)) {
|
||||
struct cec_msg_entry *entry =
|
||||
list_first_entry(&fh->msgs, struct cec_msg_entry, list);
|
||||
|
||||
list_del(&entry->list);
|
||||
kfree(entry);
|
||||
}
|
||||
kfree(fh);
|
||||
|
||||
cec_put_device(devnode);
|
||||
filp->private_data = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct file_operations cec_devnode_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = cec_open,
|
||||
.unlocked_ioctl = cec_ioctl,
|
||||
.release = cec_release,
|
||||
.poll = cec_poll,
|
||||
.llseek = no_llseek,
|
||||
};
|
413
drivers/media/cec/cec-core.c
普通文件
413
drivers/media/cec/cec-core.c
普通文件
@@ -0,0 +1,413 @@
|
||||
/*
|
||||
* cec-core.c - HDMI Consumer Electronics Control framework - Core
|
||||
*
|
||||
* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you may redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "cec-priv.h"
|
||||
|
||||
#define CEC_NUM_DEVICES 256
|
||||
#define CEC_NAME "cec"
|
||||
|
||||
int cec_debug;
|
||||
module_param_named(debug, cec_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "debug level (0-2)");
|
||||
|
||||
static dev_t cec_dev_t;
|
||||
|
||||
/* Active devices */
|
||||
static DEFINE_MUTEX(cec_devnode_lock);
|
||||
static DECLARE_BITMAP(cec_devnode_nums, CEC_NUM_DEVICES);
|
||||
|
||||
static struct dentry *top_cec_dir;
|
||||
|
||||
/* dev to cec_devnode */
|
||||
#define to_cec_devnode(cd) container_of(cd, struct cec_devnode, dev)
|
||||
|
||||
int cec_get_device(struct cec_devnode *devnode)
|
||||
{
|
||||
/*
|
||||
* Check if the cec device is available. This needs to be done with
|
||||
* the devnode->lock held to prevent an open/unregister race:
|
||||
* without the lock, the device could be unregistered and freed between
|
||||
* the devnode->registered check and get_device() calls, leading to
|
||||
* a crash.
|
||||
*/
|
||||
mutex_lock(&devnode->lock);
|
||||
/*
|
||||
* return ENXIO if the cec device has been removed
|
||||
* already or if it is not registered anymore.
|
||||
*/
|
||||
if (!devnode->registered) {
|
||||
mutex_unlock(&devnode->lock);
|
||||
return -ENXIO;
|
||||
}
|
||||
/* and increase the device refcount */
|
||||
get_device(&devnode->dev);
|
||||
mutex_unlock(&devnode->lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cec_put_device(struct cec_devnode *devnode)
|
||||
{
|
||||
put_device(&devnode->dev);
|
||||
}
|
||||
|
||||
/* Called when the last user of the cec device exits. */
|
||||
static void cec_devnode_release(struct device *cd)
|
||||
{
|
||||
struct cec_devnode *devnode = to_cec_devnode(cd);
|
||||
|
||||
mutex_lock(&cec_devnode_lock);
|
||||
/* Mark device node number as free */
|
||||
clear_bit(devnode->minor, cec_devnode_nums);
|
||||
mutex_unlock(&cec_devnode_lock);
|
||||
|
||||
cec_delete_adapter(to_cec_adapter(devnode));
|
||||
}
|
||||
|
||||
static struct bus_type cec_bus_type = {
|
||||
.name = CEC_NAME,
|
||||
};
|
||||
|
||||
/*
|
||||
* Register a cec device node
|
||||
*
|
||||
* The registration code assigns minor numbers and registers the new device node
|
||||
* with the kernel. An error is returned if no free minor number can be found,
|
||||
* or if the registration of the device node fails.
|
||||
*
|
||||
* Zero is returned on success.
|
||||
*
|
||||
* Note that if the cec_devnode_register call fails, the release() callback of
|
||||
* the cec_devnode structure is *not* called, so the caller is responsible for
|
||||
* freeing any data.
|
||||
*/
|
||||
static int __must_check cec_devnode_register(struct cec_devnode *devnode,
|
||||
struct module *owner)
|
||||
{
|
||||
int minor;
|
||||
int ret;
|
||||
|
||||
/* Initialization */
|
||||
INIT_LIST_HEAD(&devnode->fhs);
|
||||
mutex_init(&devnode->lock);
|
||||
|
||||
/* Part 1: Find a free minor number */
|
||||
mutex_lock(&cec_devnode_lock);
|
||||
minor = find_next_zero_bit(cec_devnode_nums, CEC_NUM_DEVICES, 0);
|
||||
if (minor == CEC_NUM_DEVICES) {
|
||||
mutex_unlock(&cec_devnode_lock);
|
||||
pr_err("could not get a free minor\n");
|
||||
return -ENFILE;
|
||||
}
|
||||
|
||||
set_bit(minor, cec_devnode_nums);
|
||||
mutex_unlock(&cec_devnode_lock);
|
||||
|
||||
devnode->minor = minor;
|
||||
devnode->dev.bus = &cec_bus_type;
|
||||
devnode->dev.devt = MKDEV(MAJOR(cec_dev_t), minor);
|
||||
devnode->dev.release = cec_devnode_release;
|
||||
dev_set_name(&devnode->dev, "cec%d", devnode->minor);
|
||||
device_initialize(&devnode->dev);
|
||||
|
||||
/* Part 2: Initialize and register the character device */
|
||||
cdev_init(&devnode->cdev, &cec_devnode_fops);
|
||||
devnode->cdev.kobj.parent = &devnode->dev.kobj;
|
||||
devnode->cdev.owner = owner;
|
||||
|
||||
ret = cdev_add(&devnode->cdev, devnode->dev.devt, 1);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: cdev_add failed\n", __func__);
|
||||
goto clr_bit;
|
||||
}
|
||||
|
||||
ret = device_add(&devnode->dev);
|
||||
if (ret)
|
||||
goto cdev_del;
|
||||
|
||||
devnode->registered = true;
|
||||
return 0;
|
||||
|
||||
cdev_del:
|
||||
cdev_del(&devnode->cdev);
|
||||
clr_bit:
|
||||
mutex_lock(&cec_devnode_lock);
|
||||
clear_bit(devnode->minor, cec_devnode_nums);
|
||||
mutex_unlock(&cec_devnode_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unregister a cec device node
|
||||
*
|
||||
* This unregisters the passed device. Future open calls will be met with
|
||||
* errors.
|
||||
*
|
||||
* This function can safely be called if the device node has never been
|
||||
* registered or has already been unregistered.
|
||||
*/
|
||||
static void cec_devnode_unregister(struct cec_devnode *devnode)
|
||||
{
|
||||
struct cec_fh *fh;
|
||||
|
||||
mutex_lock(&devnode->lock);
|
||||
|
||||
/* Check if devnode was never registered or already unregistered */
|
||||
if (!devnode->registered || devnode->unregistered) {
|
||||
mutex_unlock(&devnode->lock);
|
||||
return;
|
||||
}
|
||||
|
||||
list_for_each_entry(fh, &devnode->fhs, list)
|
||||
wake_up_interruptible(&fh->wait);
|
||||
|
||||
devnode->registered = false;
|
||||
devnode->unregistered = true;
|
||||
mutex_unlock(&devnode->lock);
|
||||
|
||||
device_del(&devnode->dev);
|
||||
cdev_del(&devnode->cdev);
|
||||
put_device(&devnode->dev);
|
||||
}
|
||||
|
||||
struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
|
||||
void *priv, const char *name, u32 caps,
|
||||
u8 available_las)
|
||||
{
|
||||
struct cec_adapter *adap;
|
||||
int res;
|
||||
|
||||
if (WARN_ON(!caps))
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (WARN_ON(!ops))
|
||||
return ERR_PTR(-EINVAL);
|
||||
if (WARN_ON(!available_las || available_las > CEC_MAX_LOG_ADDRS))
|
||||
return ERR_PTR(-EINVAL);
|
||||
adap = kzalloc(sizeof(*adap), GFP_KERNEL);
|
||||
if (!adap)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
strlcpy(adap->name, name, sizeof(adap->name));
|
||||
adap->phys_addr = CEC_PHYS_ADDR_INVALID;
|
||||
adap->log_addrs.cec_version = CEC_OP_CEC_VERSION_2_0;
|
||||
adap->log_addrs.vendor_id = CEC_VENDOR_ID_NONE;
|
||||
adap->capabilities = caps;
|
||||
adap->available_log_addrs = available_las;
|
||||
adap->sequence = 0;
|
||||
adap->ops = ops;
|
||||
adap->priv = priv;
|
||||
memset(adap->phys_addrs, 0xff, sizeof(adap->phys_addrs));
|
||||
mutex_init(&adap->lock);
|
||||
INIT_LIST_HEAD(&adap->transmit_queue);
|
||||
INIT_LIST_HEAD(&adap->wait_queue);
|
||||
init_waitqueue_head(&adap->kthread_waitq);
|
||||
|
||||
adap->kthread = kthread_run(cec_thread_func, adap, "cec-%s", name);
|
||||
if (IS_ERR(adap->kthread)) {
|
||||
pr_err("cec-%s: kernel_thread() failed\n", name);
|
||||
res = PTR_ERR(adap->kthread);
|
||||
kfree(adap);
|
||||
return ERR_PTR(res);
|
||||
}
|
||||
|
||||
if (!(caps & CEC_CAP_RC))
|
||||
return adap;
|
||||
|
||||
#if IS_REACHABLE(CONFIG_RC_CORE)
|
||||
/* Prepare the RC input device */
|
||||
adap->rc = rc_allocate_device();
|
||||
if (!adap->rc) {
|
||||
pr_err("cec-%s: failed to allocate memory for rc_dev\n",
|
||||
name);
|
||||
kthread_stop(adap->kthread);
|
||||
kfree(adap);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
snprintf(adap->input_name, sizeof(adap->input_name),
|
||||
"RC for %s", name);
|
||||
snprintf(adap->input_phys, sizeof(adap->input_phys),
|
||||
"%s/input0", name);
|
||||
|
||||
adap->rc->input_name = adap->input_name;
|
||||
adap->rc->input_phys = adap->input_phys;
|
||||
adap->rc->input_id.bustype = BUS_CEC;
|
||||
adap->rc->input_id.vendor = 0;
|
||||
adap->rc->input_id.product = 0;
|
||||
adap->rc->input_id.version = 1;
|
||||
adap->rc->driver_type = RC_DRIVER_SCANCODE;
|
||||
adap->rc->driver_name = CEC_NAME;
|
||||
adap->rc->allowed_protocols = RC_BIT_CEC;
|
||||
adap->rc->priv = adap;
|
||||
adap->rc->map_name = RC_MAP_CEC;
|
||||
adap->rc->timeout = MS_TO_NS(100);
|
||||
#else
|
||||
adap->capabilities &= ~CEC_CAP_RC;
|
||||
#endif
|
||||
return adap;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cec_allocate_adapter);
|
||||
|
||||
int cec_register_adapter(struct cec_adapter *adap,
|
||||
struct device *parent)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (IS_ERR_OR_NULL(adap))
|
||||
return 0;
|
||||
|
||||
if (WARN_ON(!parent))
|
||||
return -EINVAL;
|
||||
|
||||
adap->owner = parent->driver->owner;
|
||||
adap->devnode.dev.parent = parent;
|
||||
|
||||
#if IS_REACHABLE(CONFIG_RC_CORE)
|
||||
adap->rc->dev.parent = parent;
|
||||
if (adap->capabilities & CEC_CAP_RC) {
|
||||
res = rc_register_device(adap->rc);
|
||||
|
||||
if (res) {
|
||||
pr_err("cec-%s: failed to prepare input device\n",
|
||||
adap->name);
|
||||
rc_free_device(adap->rc);
|
||||
adap->rc = NULL;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
res = cec_devnode_register(&adap->devnode, adap->owner);
|
||||
if (res) {
|
||||
#if IS_REACHABLE(CONFIG_RC_CORE)
|
||||
/* Note: rc_unregister also calls rc_free */
|
||||
rc_unregister_device(adap->rc);
|
||||
adap->rc = NULL;
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&adap->devnode.dev, adap);
|
||||
#ifdef CONFIG_MEDIA_CEC_DEBUG
|
||||
if (!top_cec_dir)
|
||||
return 0;
|
||||
|
||||
adap->cec_dir = debugfs_create_dir(dev_name(&adap->devnode.dev), top_cec_dir);
|
||||
if (IS_ERR_OR_NULL(adap->cec_dir)) {
|
||||
pr_warn("cec-%s: Failed to create debugfs dir\n", adap->name);
|
||||
return 0;
|
||||
}
|
||||
adap->status_file = debugfs_create_devm_seqfile(&adap->devnode.dev,
|
||||
"status", adap->cec_dir, cec_adap_status);
|
||||
if (IS_ERR_OR_NULL(adap->status_file)) {
|
||||
pr_warn("cec-%s: Failed to create status file\n", adap->name);
|
||||
debugfs_remove_recursive(adap->cec_dir);
|
||||
adap->cec_dir = NULL;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cec_register_adapter);
|
||||
|
||||
void cec_unregister_adapter(struct cec_adapter *adap)
|
||||
{
|
||||
if (IS_ERR_OR_NULL(adap))
|
||||
return;
|
||||
|
||||
#if IS_REACHABLE(CONFIG_RC_CORE)
|
||||
/* Note: rc_unregister also calls rc_free */
|
||||
rc_unregister_device(adap->rc);
|
||||
adap->rc = NULL;
|
||||
#endif
|
||||
debugfs_remove_recursive(adap->cec_dir);
|
||||
cec_devnode_unregister(&adap->devnode);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cec_unregister_adapter);
|
||||
|
||||
void cec_delete_adapter(struct cec_adapter *adap)
|
||||
{
|
||||
if (IS_ERR_OR_NULL(adap))
|
||||
return;
|
||||
mutex_lock(&adap->lock);
|
||||
__cec_s_phys_addr(adap, CEC_PHYS_ADDR_INVALID, false);
|
||||
mutex_unlock(&adap->lock);
|
||||
kthread_stop(adap->kthread);
|
||||
if (adap->kthread_config)
|
||||
kthread_stop(adap->kthread_config);
|
||||
#if IS_REACHABLE(CONFIG_RC_CORE)
|
||||
rc_free_device(adap->rc);
|
||||
#endif
|
||||
kfree(adap);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cec_delete_adapter);
|
||||
|
||||
/*
|
||||
* Initialise cec for linux
|
||||
*/
|
||||
static int __init cec_devnode_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
pr_info("Linux cec interface: v0.10\n");
|
||||
ret = alloc_chrdev_region(&cec_dev_t, 0, CEC_NUM_DEVICES,
|
||||
CEC_NAME);
|
||||
if (ret < 0) {
|
||||
pr_warn("cec: unable to allocate major\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MEDIA_CEC_DEBUG
|
||||
top_cec_dir = debugfs_create_dir("cec", NULL);
|
||||
if (IS_ERR_OR_NULL(top_cec_dir)) {
|
||||
pr_warn("cec: Failed to create debugfs cec dir\n");
|
||||
top_cec_dir = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = bus_register(&cec_bus_type);
|
||||
if (ret < 0) {
|
||||
unregister_chrdev_region(cec_dev_t, CEC_NUM_DEVICES);
|
||||
pr_warn("cec: bus_register failed\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit cec_devnode_exit(void)
|
||||
{
|
||||
debugfs_remove_recursive(top_cec_dir);
|
||||
bus_unregister(&cec_bus_type);
|
||||
unregister_chrdev_region(cec_dev_t, CEC_NUM_DEVICES);
|
||||
}
|
||||
|
||||
subsys_initcall(cec_devnode_init);
|
||||
module_exit(cec_devnode_exit)
|
||||
|
||||
MODULE_AUTHOR("Hans Verkuil <hans.verkuil@cisco.com>");
|
||||
MODULE_DESCRIPTION("Device node registration for cec drivers");
|
||||
MODULE_LICENSE("GPL");
|
56
drivers/media/cec/cec-priv.h
普通文件
56
drivers/media/cec/cec-priv.h
普通文件
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* cec-priv.h - HDMI Consumer Electronics Control internal header
|
||||
*
|
||||
* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program is free software; you may redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _CEC_PRIV_H
|
||||
#define _CEC_PRIV_H
|
||||
|
||||
#include <linux/cec-funcs.h>
|
||||
#include <media/cec.h>
|
||||
|
||||
#define dprintk(lvl, fmt, arg...) \
|
||||
do { \
|
||||
if (lvl <= cec_debug) \
|
||||
pr_info("cec-%s: " fmt, adap->name, ## arg); \
|
||||
} while (0)
|
||||
|
||||
/* devnode to cec_adapter */
|
||||
#define to_cec_adapter(node) container_of(node, struct cec_adapter, devnode)
|
||||
|
||||
/* cec-core.c */
|
||||
extern int cec_debug;
|
||||
int cec_get_device(struct cec_devnode *devnode);
|
||||
void cec_put_device(struct cec_devnode *devnode);
|
||||
|
||||
/* cec-adap.c */
|
||||
int cec_monitor_all_cnt_inc(struct cec_adapter *adap);
|
||||
void cec_monitor_all_cnt_dec(struct cec_adapter *adap);
|
||||
int cec_adap_status(struct seq_file *file, void *priv);
|
||||
int cec_thread_func(void *_adap);
|
||||
void __cec_s_phys_addr(struct cec_adapter *adap, u16 phys_addr, bool block);
|
||||
int __cec_s_log_addrs(struct cec_adapter *adap,
|
||||
struct cec_log_addrs *log_addrs, bool block);
|
||||
int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
|
||||
struct cec_fh *fh, bool block);
|
||||
void cec_queue_event_fh(struct cec_fh *fh,
|
||||
const struct cec_event *new_ev, u64 ts);
|
||||
|
||||
/* cec-api.c */
|
||||
extern const struct file_operations cec_devnode_fops;
|
||||
|
||||
#endif
|
@@ -14,7 +14,6 @@
|
||||
|
||||
#include "dmxdev.h"
|
||||
#include "dvb_demux.h"
|
||||
#include "dvb_filter.h"
|
||||
#include "dvb_net.h"
|
||||
#include "dvb_frontend.h"
|
||||
|
||||
|
@@ -136,8 +136,7 @@ int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended)
|
||||
|
||||
if ((ret = flexcop_eeprom_lrc_read(fc,0x3f8,buf,8,4)) == 0) {
|
||||
if (extended != 0) {
|
||||
err("TODO: extended (EUI64) MAC addresses aren't "
|
||||
"completely supported yet");
|
||||
err("TODO: extended (EUI64) MAC addresses aren't completely supported yet");
|
||||
ret = -EINVAL;
|
||||
} else
|
||||
memcpy(fc->dvb_adapter.proposed_mac,buf,6);
|
||||
|
@@ -33,8 +33,8 @@ static int flexcop_i2c_operation(struct flexcop_device *fc,
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
}
|
||||
deb_i2c("tried %d times i2c operation, "
|
||||
"never finished or too many ack errors.\n", i);
|
||||
deb_i2c("tried %d times i2c operation, never finished or too many ack errors.\n",
|
||||
i);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
@@ -124,10 +124,10 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c,
|
||||
#ifdef DUMP_I2C_MESSAGES
|
||||
printk(KERN_DEBUG "%d ", i2c->port);
|
||||
if (op == FC_READ)
|
||||
printk("rd(");
|
||||
printk(KERN_CONT "rd(");
|
||||
else
|
||||
printk("wr(");
|
||||
printk("%02x): %02x ", chipaddr, addr);
|
||||
printk(KERN_CONT "wr(");
|
||||
printk(KERN_CONT "%02x): %02x ", chipaddr, addr);
|
||||
#endif
|
||||
|
||||
/* in that case addr is the only value ->
|
||||
@@ -151,7 +151,7 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c,
|
||||
|
||||
#ifdef DUMP_I2C_MESSAGES
|
||||
for (i = 0; i < bytes_to_transfer; i++)
|
||||
printk("%02x ", buf[i]);
|
||||
printk(KERN_CONT "%02x ", buf[i]);
|
||||
#endif
|
||||
|
||||
if (ret < 0)
|
||||
@@ -163,7 +163,7 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c,
|
||||
}
|
||||
|
||||
#ifdef DUMP_I2C_MESSAGES
|
||||
printk("\n");
|
||||
printk(KERN_CONT "\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@@ -23,18 +23,15 @@ void flexcop_determine_revision(struct flexcop_device *fc)
|
||||
fc->rev = FLEXCOP_III;
|
||||
break;
|
||||
default:
|
||||
err("unknown FlexCop Revision: %x. Please report this to "
|
||||
"linux-dvb@linuxtv.org.",
|
||||
err("unknown FlexCop Revision: %x. Please report this to linux-dvb@linuxtv.org.",
|
||||
v.misc_204.Rev_N_sig_revision_hi);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((fc->has_32_hw_pid_filter = v.misc_204.Rev_N_sig_caps))
|
||||
deb_info("this FlexCop has "
|
||||
"the additional 32 hardware pid filter.\n");
|
||||
deb_info("this FlexCop has the additional 32 hardware pid filter.\n");
|
||||
else
|
||||
deb_info("this FlexCop has "
|
||||
"the 6 basic main hardware pid filter.\n");
|
||||
deb_info("this FlexCop has the 6 basic main hardware pid filter.\n");
|
||||
/* bus parts have to decide if hw pid filtering is used or not. */
|
||||
}
|
||||
|
||||
|
@@ -46,8 +46,7 @@ int b2c2_flexcop_debug;
|
||||
EXPORT_SYMBOL_GPL(b2c2_flexcop_debug);
|
||||
module_param_named(debug, b2c2_flexcop_debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug,
|
||||
"set debug level (1=info,2=tuner,4=i2c,8=ts,"
|
||||
"16=sram,32=reg (|-able))."
|
||||
"set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))."
|
||||
DEBSTATUS);
|
||||
#undef DEBSTATUS
|
||||
|
||||
|
@@ -1190,8 +1190,8 @@ void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix)
|
||||
prefix,
|
||||
cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE));
|
||||
if (p->stream_insert_nav_packets)
|
||||
printk(" (with navigation packets)");
|
||||
printk("\n");
|
||||
printk(KERN_CONT " (with navigation packets)");
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_INFO "%s: VBI Format: %s\n",
|
||||
prefix,
|
||||
cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_VBI_FMT));
|
||||
@@ -1209,8 +1209,8 @@ void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix)
|
||||
cx2341x_menu_item(p, V4L2_CID_MPEG_VIDEO_BITRATE_MODE),
|
||||
p->video_bitrate);
|
||||
if (p->video_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR)
|
||||
printk(", Peak %d", p->video_bitrate_peak);
|
||||
printk("\n");
|
||||
printk(KERN_CONT ", Peak %d", p->video_bitrate_peak);
|
||||
printk(KERN_CONT "\n");
|
||||
printk(KERN_INFO
|
||||
"%s: Video: GOP Size %d, %d B-Frames, %sGOP Closure\n",
|
||||
prefix,
|
||||
@@ -1232,9 +1232,9 @@ void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix)
|
||||
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_MODE),
|
||||
p->audio_mute ? " (muted)" : "");
|
||||
if (p->audio_mode == V4L2_MPEG_AUDIO_MODE_JOINT_STEREO)
|
||||
printk(", %s", cx2341x_menu_item(p,
|
||||
printk(KERN_CONT ", %s", cx2341x_menu_item(p,
|
||||
V4L2_CID_MPEG_AUDIO_MODE_EXTENSION));
|
||||
printk(", %s, %s\n",
|
||||
printk(KERN_CONT ", %s, %s\n",
|
||||
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_EMPHASIS),
|
||||
cx2341x_menu_item(p, V4L2_CID_MPEG_AUDIO_CRC));
|
||||
|
||||
|
@@ -390,6 +390,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
|
||||
{
|
||||
struct saa7146_dev *dev = fh->dev;
|
||||
struct saa7146_vv *vv = dev->vv_data;
|
||||
struct saa7146_dmaqueue *q = &vv->video_dmaq;
|
||||
struct saa7146_format *fmt = NULL;
|
||||
unsigned long flags;
|
||||
unsigned int resource;
|
||||
@@ -428,6 +429,9 @@ static int video_end(struct saa7146_fh *fh, struct file *file)
|
||||
/* shut down all used video dma transfers */
|
||||
saa7146_write(dev, MC1, dmas);
|
||||
|
||||
if (q->curr)
|
||||
saa7146_buffer_finish(dev, q, VIDEOBUF_DONE);
|
||||
|
||||
spin_unlock_irqrestore(&dev->slock, flags);
|
||||
|
||||
vv->video_fh = NULL;
|
||||
|
@@ -1044,7 +1044,7 @@ static void smsdvb_release(struct dvb_frontend *fe)
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops smsdvb_fe_ops = {
|
||||
static const struct dvb_frontend_ops smsdvb_fe_ops = {
|
||||
.info = {
|
||||
.name = "Siano Mobile Digital MDTV Receiver",
|
||||
.frequency_min = 44250000,
|
||||
|
@@ -28,6 +28,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/errno.h>
|
||||
@@ -45,22 +46,9 @@ MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver");
|
||||
MODULE_AUTHOR("John Klar");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "Debug level (0-1)");
|
||||
|
||||
#define STRM(array, i) \
|
||||
(i < sizeof(array) / sizeof(char *) ? array[i] : "unknown")
|
||||
|
||||
#define tveeprom_info(fmt, arg...) \
|
||||
v4l_printk(KERN_INFO, "tveeprom", c->adapter, c->addr, fmt , ## arg)
|
||||
#define tveeprom_warn(fmt, arg...) \
|
||||
v4l_printk(KERN_WARNING, "tveeprom", c->adapter, c->addr, fmt , ## arg)
|
||||
#define tveeprom_dbg(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
v4l_printk(KERN_DEBUG, "tveeprom", \
|
||||
c->adapter, c->addr, fmt , ## arg); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* The Hauppauge eeprom uses an 8bit field to determine which
|
||||
@@ -510,19 +498,13 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
|
||||
len = eeprom_data[i] & 0x07;
|
||||
++i;
|
||||
} else {
|
||||
tveeprom_warn("Encountered bad packet header [%02x]. "
|
||||
"Corrupt or not a Hauppauge eeprom.\n",
|
||||
pr_warn("Encountered bad packet header [%02x]. Corrupt or not a Hauppauge eeprom.\n",
|
||||
eeprom_data[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
tveeprom_info("Tag [%02x] + %d bytes:",
|
||||
eeprom_data[i], len - 1);
|
||||
for (j = 1; j < len; j++)
|
||||
printk(KERN_CONT " %02x", eeprom_data[i + j]);
|
||||
printk(KERN_CONT "\n");
|
||||
}
|
||||
pr_debug("Tag [%02x] + %d bytes: %*ph\n",
|
||||
eeprom_data[i], len - 1, len, &eeprom_data[i]);
|
||||
|
||||
/* process by tag */
|
||||
tag = eeprom_data[i];
|
||||
@@ -662,14 +644,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
|
||||
/* case 0x12: tag 'InfoBits' */
|
||||
|
||||
default:
|
||||
tveeprom_dbg("Not sure what to do with tag [%02x]\n",
|
||||
pr_debug("Not sure what to do with tag [%02x]\n",
|
||||
tag);
|
||||
/* dump the rest of the packet? */
|
||||
}
|
||||
}
|
||||
|
||||
if (!done) {
|
||||
tveeprom_warn("Ran out of data!\n");
|
||||
pr_warn("Ran out of data!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -682,8 +664,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
|
||||
}
|
||||
|
||||
if (hasRadioTuner(tuner1) && !tvee->has_radio) {
|
||||
tveeprom_info("The eeprom says no radio is present, but the tuner type\n");
|
||||
tveeprom_info("indicates otherwise. I will assume that radio is present.\n");
|
||||
pr_info("The eeprom says no radio is present, but the tuner type\n");
|
||||
pr_info("indicates otherwise. I will assume that radio is present.\n");
|
||||
tvee->has_radio = 1;
|
||||
}
|
||||
|
||||
@@ -718,46 +700,46 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
|
||||
}
|
||||
}
|
||||
|
||||
tveeprom_info("Hauppauge model %d, rev %s, serial# %u\n",
|
||||
pr_info("Hauppauge model %d, rev %s, serial# %u\n",
|
||||
tvee->model, tvee->rev_str, tvee->serial_number);
|
||||
if (tvee->has_MAC_address == 1)
|
||||
tveeprom_info("MAC address is %pM\n", tvee->MAC_address);
|
||||
tveeprom_info("tuner model is %s (idx %d, type %d)\n",
|
||||
pr_info("MAC address is %pM\n", tvee->MAC_address);
|
||||
pr_info("tuner model is %s (idx %d, type %d)\n",
|
||||
t_name1, tuner1, tvee->tuner_type);
|
||||
tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
|
||||
pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
|
||||
t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2],
|
||||
t_fmt_name1[3], t_fmt_name1[4], t_fmt_name1[5],
|
||||
t_fmt_name1[6], t_fmt_name1[7], t_format1);
|
||||
if (tuner2)
|
||||
tveeprom_info("second tuner model is %s (idx %d, type %d)\n",
|
||||
pr_info("second tuner model is %s (idx %d, type %d)\n",
|
||||
t_name2, tuner2, tvee->tuner2_type);
|
||||
if (t_format2)
|
||||
tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
|
||||
pr_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
|
||||
t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2],
|
||||
t_fmt_name2[3], t_fmt_name2[4], t_fmt_name2[5],
|
||||
t_fmt_name2[6], t_fmt_name2[7], t_format2);
|
||||
if (audioic < 0) {
|
||||
tveeprom_info("audio processor is unknown (no idx)\n");
|
||||
pr_info("audio processor is unknown (no idx)\n");
|
||||
tvee->audio_processor = TVEEPROM_AUDPROC_OTHER;
|
||||
} else {
|
||||
if (audioic < ARRAY_SIZE(audio_ic))
|
||||
tveeprom_info("audio processor is %s (idx %d)\n",
|
||||
pr_info("audio processor is %s (idx %d)\n",
|
||||
audio_ic[audioic].name, audioic);
|
||||
else
|
||||
tveeprom_info("audio processor is unknown (idx %d)\n",
|
||||
pr_info("audio processor is unknown (idx %d)\n",
|
||||
audioic);
|
||||
}
|
||||
if (tvee->decoder_processor)
|
||||
tveeprom_info("decoder processor is %s (idx %d)\n",
|
||||
pr_info("decoder processor is %s (idx %d)\n",
|
||||
STRM(decoderIC, tvee->decoder_processor),
|
||||
tvee->decoder_processor);
|
||||
if (tvee->has_ir)
|
||||
tveeprom_info("has %sradio, has %sIR receiver, has %sIR transmitter\n",
|
||||
pr_info("has %sradio, has %sIR receiver, has %sIR transmitter\n",
|
||||
tvee->has_radio ? "" : "no ",
|
||||
(tvee->has_ir & 2) ? "" : "no ",
|
||||
(tvee->has_ir & 4) ? "" : "no ");
|
||||
else
|
||||
tveeprom_info("has %sradio\n",
|
||||
pr_info("has %sradio\n",
|
||||
tvee->has_radio ? "" : "no ");
|
||||
}
|
||||
EXPORT_SYMBOL(tveeprom_hauppauge_analog);
|
||||
@@ -773,26 +755,17 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
|
||||
buf = 0;
|
||||
err = i2c_master_send(c, &buf, 1);
|
||||
if (err != 1) {
|
||||
tveeprom_info("Huh, no eeprom present (err=%d)?\n", err);
|
||||
pr_info("Huh, no eeprom present (err=%d)?\n", err);
|
||||
return -1;
|
||||
}
|
||||
err = i2c_master_recv(c, eedata, len);
|
||||
if (err != len) {
|
||||
tveeprom_warn("i2c eeprom read error (err=%d)\n", err);
|
||||
pr_warn("i2c eeprom read error (err=%d)\n", err);
|
||||
return -1;
|
||||
}
|
||||
if (debug) {
|
||||
int i;
|
||||
|
||||
tveeprom_info("full 256-byte eeprom dump:\n");
|
||||
for (i = 0; i < len; i++) {
|
||||
if (0 == (i % 16))
|
||||
tveeprom_info("%02x:", i);
|
||||
printk(KERN_CONT " %02x", eedata[i]);
|
||||
if (15 == (i % 16))
|
||||
printk(KERN_CONT "\n");
|
||||
}
|
||||
}
|
||||
print_hex_dump_debug("full 256-byte eeprom dump:", DUMP_PREFIX_NONE,
|
||||
16, 1, eedata, len, true);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(tveeprom_read);
|
||||
|
@@ -117,6 +117,7 @@ void tpg_init(struct tpg_data *tpg, unsigned w, unsigned h)
|
||||
tpg_s_fourcc(tpg, V4L2_PIX_FMT_RGB24);
|
||||
tpg->colorspace = V4L2_COLORSPACE_SRGB;
|
||||
tpg->perc_fill = 100;
|
||||
tpg->hsv_enc = V4L2_HSV_ENC_180;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tpg_init);
|
||||
|
||||
@@ -234,16 +235,18 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
case V4L2_PIX_FMT_XBGR32:
|
||||
case V4L2_PIX_FMT_ARGB32:
|
||||
case V4L2_PIX_FMT_ABGR32:
|
||||
tpg->color_enc = TGP_COLOR_ENC_RGB;
|
||||
break;
|
||||
case V4L2_PIX_FMT_GREY:
|
||||
case V4L2_PIX_FMT_Y16:
|
||||
case V4L2_PIX_FMT_Y16_BE:
|
||||
tpg->is_yuv = false;
|
||||
tpg->color_enc = TGP_COLOR_ENC_LUMA;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV444:
|
||||
case V4L2_PIX_FMT_YUV555:
|
||||
case V4L2_PIX_FMT_YUV565:
|
||||
case V4L2_PIX_FMT_YUV32:
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV420M:
|
||||
case V4L2_PIX_FMT_YVU420M:
|
||||
@@ -256,7 +259,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
tpg->hdownsampling[1] = 2;
|
||||
tpg->hdownsampling[2] = 2;
|
||||
tpg->planes = 3;
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV422M:
|
||||
case V4L2_PIX_FMT_YVU422M:
|
||||
@@ -268,7 +271,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
tpg->hdownsampling[1] = 2;
|
||||
tpg->hdownsampling[2] = 2;
|
||||
tpg->planes = 3;
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV16M:
|
||||
case V4L2_PIX_FMT_NV61M:
|
||||
@@ -280,7 +283,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
tpg->hdownsampling[1] = 1;
|
||||
tpg->hmask[1] = ~1;
|
||||
tpg->planes = 2;
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV12M:
|
||||
case V4L2_PIX_FMT_NV21M:
|
||||
@@ -292,7 +295,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
tpg->hdownsampling[1] = 1;
|
||||
tpg->hmask[1] = ~1;
|
||||
tpg->planes = 2;
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV444M:
|
||||
case V4L2_PIX_FMT_YVU444M:
|
||||
@@ -302,21 +305,25 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
tpg->vdownsampling[2] = 1;
|
||||
tpg->hdownsampling[1] = 1;
|
||||
tpg->hdownsampling[2] = 1;
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV24:
|
||||
case V4L2_PIX_FMT_NV42:
|
||||
tpg->vdownsampling[1] = 1;
|
||||
tpg->hdownsampling[1] = 1;
|
||||
tpg->planes = 2;
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
case V4L2_PIX_FMT_YVYU:
|
||||
case V4L2_PIX_FMT_VYUY:
|
||||
tpg->hmask[0] = ~1;
|
||||
tpg->is_yuv = true;
|
||||
tpg->color_enc = TGP_COLOR_ENC_YCBCR;
|
||||
break;
|
||||
case V4L2_PIX_FMT_HSV24:
|
||||
case V4L2_PIX_FMT_HSV32:
|
||||
tpg->color_enc = TGP_COLOR_ENC_HSV;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@@ -351,6 +358,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB24:
|
||||
case V4L2_PIX_FMT_BGR24:
|
||||
case V4L2_PIX_FMT_HSV24:
|
||||
tpg->twopixelsize[0] = 2 * 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_BGR666:
|
||||
@@ -361,6 +369,7 @@ bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc)
|
||||
case V4L2_PIX_FMT_ARGB32:
|
||||
case V4L2_PIX_FMT_ABGR32:
|
||||
case V4L2_PIX_FMT_YUV32:
|
||||
case V4L2_PIX_FMT_HSV32:
|
||||
tpg->twopixelsize[0] = 2 * 4;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
@@ -490,6 +499,71 @@ static inline int linear_to_rec709(int v)
|
||||
return tpg_linear_to_rec709[v];
|
||||
}
|
||||
|
||||
static void color_to_hsv(struct tpg_data *tpg, int r, int g, int b,
|
||||
int *h, int *s, int *v)
|
||||
{
|
||||
int max_rgb, min_rgb, diff_rgb;
|
||||
int aux;
|
||||
int third;
|
||||
int third_size;
|
||||
|
||||
r >>= 4;
|
||||
g >>= 4;
|
||||
b >>= 4;
|
||||
|
||||
/* Value */
|
||||
max_rgb = max3(r, g, b);
|
||||
*v = max_rgb;
|
||||
if (!max_rgb) {
|
||||
*h = 0;
|
||||
*s = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Saturation */
|
||||
min_rgb = min3(r, g, b);
|
||||
diff_rgb = max_rgb - min_rgb;
|
||||
aux = 255 * diff_rgb;
|
||||
aux += max_rgb / 2;
|
||||
aux /= max_rgb;
|
||||
*s = aux;
|
||||
if (!aux) {
|
||||
*h = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
third_size = (tpg->real_hsv_enc == V4L2_HSV_ENC_180) ? 60 : 85;
|
||||
|
||||
/* Hue */
|
||||
if (max_rgb == r) {
|
||||
aux = g - b;
|
||||
third = 0;
|
||||
} else if (max_rgb == g) {
|
||||
aux = b - r;
|
||||
third = third_size;
|
||||
} else {
|
||||
aux = r - g;
|
||||
third = third_size * 2;
|
||||
}
|
||||
|
||||
aux *= third_size / 2;
|
||||
aux += diff_rgb / 2;
|
||||
aux /= diff_rgb;
|
||||
aux += third;
|
||||
|
||||
/* Clamp Hue */
|
||||
if (tpg->real_hsv_enc == V4L2_HSV_ENC_180) {
|
||||
if (aux < 0)
|
||||
aux += 180;
|
||||
else if (aux > 180)
|
||||
aux -= 180;
|
||||
} else {
|
||||
aux = aux & 0xff;
|
||||
}
|
||||
|
||||
*h = aux;
|
||||
}
|
||||
|
||||
static void rgb2ycbcr(const int m[3][3], int r, int g, int b,
|
||||
int y_offset, int *y, int *cb, int *cr)
|
||||
{
|
||||
@@ -729,6 +803,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
int r = tpg_colors[col].r;
|
||||
int g = tpg_colors[col].g;
|
||||
int b = tpg_colors[col].b;
|
||||
int y, cb, cr;
|
||||
bool ycbcr_valid = false;
|
||||
|
||||
if (k == TPG_COLOR_TEXTBG) {
|
||||
col = tpg_get_textbg_color(tpg);
|
||||
@@ -759,9 +835,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
g <<= 4;
|
||||
b <<= 4;
|
||||
}
|
||||
if (tpg->qual == TPG_QUAL_GRAY || tpg->fourcc == V4L2_PIX_FMT_GREY ||
|
||||
tpg->fourcc == V4L2_PIX_FMT_Y16 ||
|
||||
tpg->fourcc == V4L2_PIX_FMT_Y16_BE) {
|
||||
|
||||
if (tpg->qual == TPG_QUAL_GRAY ||
|
||||
tpg->color_enc == TGP_COLOR_ENC_LUMA) {
|
||||
/* Rec. 709 Luma function */
|
||||
/* (0.2126, 0.7152, 0.0722) * (255 * 256) */
|
||||
r = g = b = (13879 * r + 46688 * g + 4713 * b) >> 16;
|
||||
@@ -775,7 +851,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
* Remember that r, g and b are still in the 0 - 0xff0 range.
|
||||
*/
|
||||
if (tpg->real_rgb_range == V4L2_DV_RGB_RANGE_LIMITED &&
|
||||
tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL && !tpg->is_yuv) {
|
||||
tpg->rgb_range == V4L2_DV_RGB_RANGE_FULL &&
|
||||
tpg->color_enc == TGP_COLOR_ENC_RGB) {
|
||||
/*
|
||||
* Convert from full range (which is what r, g and b are)
|
||||
* to limited range (which is the 'real' RGB range), which
|
||||
@@ -785,7 +862,9 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
g = (g * 219) / 255 + (16 << 4);
|
||||
b = (b * 219) / 255 + (16 << 4);
|
||||
} else if (tpg->real_rgb_range != V4L2_DV_RGB_RANGE_LIMITED &&
|
||||
tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED && !tpg->is_yuv) {
|
||||
tpg->rgb_range == V4L2_DV_RGB_RANGE_LIMITED &&
|
||||
tpg->color_enc == TGP_COLOR_ENC_RGB) {
|
||||
|
||||
/*
|
||||
* Clamp r, g and b to the limited range and convert to full
|
||||
* range since that's what we deliver.
|
||||
@@ -798,10 +877,10 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
b = (b - (16 << 4)) * 255 / 219;
|
||||
}
|
||||
|
||||
if (tpg->brightness != 128 || tpg->contrast != 128 ||
|
||||
tpg->saturation != 128 || tpg->hue) {
|
||||
if ((tpg->brightness != 128 || tpg->contrast != 128 ||
|
||||
tpg->saturation != 128 || tpg->hue) &&
|
||||
tpg->color_enc != TGP_COLOR_ENC_LUMA) {
|
||||
/* Implement these operations */
|
||||
int y, cb, cr;
|
||||
int tmp_cb, tmp_cr;
|
||||
|
||||
/* First convert to YCbCr */
|
||||
@@ -818,29 +897,45 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
|
||||
cb = (128 << 4) + (tmp_cb * tpg->contrast * tpg->saturation) / (128 * 128);
|
||||
cr = (128 << 4) + (tmp_cr * tpg->contrast * tpg->saturation) / (128 * 128);
|
||||
if (tpg->is_yuv) {
|
||||
tpg->colors[k][0] = clamp(y >> 4, 1, 254);
|
||||
tpg->colors[k][1] = clamp(cb >> 4, 1, 254);
|
||||
tpg->colors[k][2] = clamp(cr >> 4, 1, 254);
|
||||
return;
|
||||
}
|
||||
ycbcr_to_color(tpg, y, cb, cr, &r, &g, &b);
|
||||
if (tpg->color_enc == TGP_COLOR_ENC_YCBCR)
|
||||
ycbcr_valid = true;
|
||||
else
|
||||
ycbcr_to_color(tpg, y, cb, cr, &r, &g, &b);
|
||||
} else if ((tpg->brightness != 128 || tpg->contrast != 128) &&
|
||||
tpg->color_enc == TGP_COLOR_ENC_LUMA) {
|
||||
r = (16 << 4) + ((r - (16 << 4)) * tpg->contrast) / 128;
|
||||
r += (tpg->brightness << 4) - (128 << 4);
|
||||
}
|
||||
|
||||
if (tpg->is_yuv) {
|
||||
switch (tpg->color_enc) {
|
||||
case TGP_COLOR_ENC_HSV:
|
||||
{
|
||||
int h, s, v;
|
||||
|
||||
color_to_hsv(tpg, r, g, b, &h, &s, &v);
|
||||
tpg->colors[k][0] = h;
|
||||
tpg->colors[k][1] = s;
|
||||
tpg->colors[k][2] = v;
|
||||
break;
|
||||
}
|
||||
case TGP_COLOR_ENC_YCBCR:
|
||||
{
|
||||
/* Convert to YCbCr */
|
||||
int y, cb, cr;
|
||||
|
||||
color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr);
|
||||
if (!ycbcr_valid)
|
||||
color_to_ycbcr(tpg, r, g, b, &y, &cb, &cr);
|
||||
|
||||
y >>= 4;
|
||||
cb >>= 4;
|
||||
cr >>= 4;
|
||||
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
|
||||
y = clamp(y, 16 << 4, 235 << 4);
|
||||
cb = clamp(cb, 16 << 4, 240 << 4);
|
||||
cr = clamp(cr, 16 << 4, 240 << 4);
|
||||
y = clamp(y, 16, 235);
|
||||
cb = clamp(cb, 16, 240);
|
||||
cr = clamp(cr, 16, 240);
|
||||
} else {
|
||||
y = clamp(y, 1, 254);
|
||||
cb = clamp(cb, 1, 254);
|
||||
cr = clamp(cr, 1, 254);
|
||||
}
|
||||
y = clamp(y >> 4, 1, 254);
|
||||
cb = clamp(cb >> 4, 1, 254);
|
||||
cr = clamp(cr >> 4, 1, 254);
|
||||
switch (tpg->fourcc) {
|
||||
case V4L2_PIX_FMT_YUV444:
|
||||
y >>= 4;
|
||||
@@ -861,7 +956,15 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
tpg->colors[k][0] = y;
|
||||
tpg->colors[k][1] = cb;
|
||||
tpg->colors[k][2] = cr;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
case TGP_COLOR_ENC_LUMA:
|
||||
{
|
||||
tpg->colors[k][0] = r >> 4;
|
||||
break;
|
||||
}
|
||||
case TGP_COLOR_ENC_RGB:
|
||||
{
|
||||
if (tpg->real_quantization == V4L2_QUANTIZATION_LIM_RANGE) {
|
||||
r = (r * 219) / 255 + (16 << 4);
|
||||
g = (g * 219) / 255 + (16 << 4);
|
||||
@@ -911,6 +1014,8 @@ static void precalculate_color(struct tpg_data *tpg, int k)
|
||||
tpg->colors[k][0] = r;
|
||||
tpg->colors[k][1] = g;
|
||||
tpg->colors[k][2] = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -928,7 +1033,7 @@ static void gen_twopix(struct tpg_data *tpg,
|
||||
{
|
||||
unsigned offset = odd * tpg->twopixelsize[0] / 2;
|
||||
u8 alpha = tpg->alpha_component;
|
||||
u8 r_y, g_u, b_v;
|
||||
u8 r_y_h, g_u_s, b_v;
|
||||
|
||||
if (tpg->alpha_red_only && color != TPG_COLOR_CSC_RED &&
|
||||
color != TPG_COLOR_100_RED &&
|
||||
@@ -936,161 +1041,161 @@ static void gen_twopix(struct tpg_data *tpg,
|
||||
alpha = 0;
|
||||
if (color == TPG_COLOR_RANDOM)
|
||||
precalculate_color(tpg, color);
|
||||
r_y = tpg->colors[color][0]; /* R or precalculated Y */
|
||||
g_u = tpg->colors[color][1]; /* G or precalculated U */
|
||||
r_y_h = tpg->colors[color][0]; /* R or precalculated Y, H */
|
||||
g_u_s = tpg->colors[color][1]; /* G or precalculated U, V */
|
||||
b_v = tpg->colors[color][2]; /* B or precalculated V */
|
||||
|
||||
switch (tpg->fourcc) {
|
||||
case V4L2_PIX_FMT_GREY:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
break;
|
||||
case V4L2_PIX_FMT_Y16:
|
||||
/*
|
||||
* Ideally both bytes should be set to r_y, but then you won't
|
||||
* Ideally both bytes should be set to r_y_h, but then you won't
|
||||
* be able to detect endian problems. So keep it 0 except for
|
||||
* the corner case where r_y is 0xff so white really will be
|
||||
* the corner case where r_y_h is 0xff so white really will be
|
||||
* white (0xffff).
|
||||
*/
|
||||
buf[0][offset] = r_y == 0xff ? r_y : 0;
|
||||
buf[0][offset+1] = r_y;
|
||||
buf[0][offset] = r_y_h == 0xff ? r_y_h : 0;
|
||||
buf[0][offset+1] = r_y_h;
|
||||
break;
|
||||
case V4L2_PIX_FMT_Y16_BE:
|
||||
/* See comment for V4L2_PIX_FMT_Y16 above */
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset+1] = r_y == 0xff ? r_y : 0;
|
||||
buf[0][offset] = r_y_h;
|
||||
buf[0][offset+1] = r_y_h == 0xff ? r_y_h : 0;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV422M:
|
||||
case V4L2_PIX_FMT_YUV422P:
|
||||
case V4L2_PIX_FMT_YUV420:
|
||||
case V4L2_PIX_FMT_YUV420M:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
if (odd) {
|
||||
buf[1][0] = (buf[1][0] + g_u) / 2;
|
||||
buf[1][0] = (buf[1][0] + g_u_s) / 2;
|
||||
buf[2][0] = (buf[2][0] + b_v) / 2;
|
||||
buf[1][1] = buf[1][0];
|
||||
buf[2][1] = buf[2][0];
|
||||
break;
|
||||
}
|
||||
buf[1][0] = g_u;
|
||||
buf[1][0] = g_u_s;
|
||||
buf[2][0] = b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YVU422M:
|
||||
case V4L2_PIX_FMT_YVU420:
|
||||
case V4L2_PIX_FMT_YVU420M:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
if (odd) {
|
||||
buf[1][0] = (buf[1][0] + b_v) / 2;
|
||||
buf[2][0] = (buf[2][0] + g_u) / 2;
|
||||
buf[2][0] = (buf[2][0] + g_u_s) / 2;
|
||||
buf[1][1] = buf[1][0];
|
||||
buf[2][1] = buf[2][0];
|
||||
break;
|
||||
}
|
||||
buf[1][0] = b_v;
|
||||
buf[2][0] = g_u;
|
||||
buf[2][0] = g_u_s;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
case V4L2_PIX_FMT_NV12M:
|
||||
case V4L2_PIX_FMT_NV16:
|
||||
case V4L2_PIX_FMT_NV16M:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
if (odd) {
|
||||
buf[1][0] = (buf[1][0] + g_u) / 2;
|
||||
buf[1][0] = (buf[1][0] + g_u_s) / 2;
|
||||
buf[1][1] = (buf[1][1] + b_v) / 2;
|
||||
break;
|
||||
}
|
||||
buf[1][0] = g_u;
|
||||
buf[1][0] = g_u_s;
|
||||
buf[1][1] = b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_NV21:
|
||||
case V4L2_PIX_FMT_NV21M:
|
||||
case V4L2_PIX_FMT_NV61:
|
||||
case V4L2_PIX_FMT_NV61M:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
if (odd) {
|
||||
buf[1][0] = (buf[1][0] + b_v) / 2;
|
||||
buf[1][1] = (buf[1][1] + g_u) / 2;
|
||||
buf[1][1] = (buf[1][1] + g_u_s) / 2;
|
||||
break;
|
||||
}
|
||||
buf[1][0] = b_v;
|
||||
buf[1][1] = g_u;
|
||||
buf[1][1] = g_u_s;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_YUV444M:
|
||||
buf[0][offset] = r_y;
|
||||
buf[1][offset] = g_u;
|
||||
buf[0][offset] = r_y_h;
|
||||
buf[1][offset] = g_u_s;
|
||||
buf[2][offset] = b_v;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_YVU444M:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
buf[1][offset] = b_v;
|
||||
buf[2][offset] = g_u;
|
||||
buf[2][offset] = g_u_s;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_NV24:
|
||||
buf[0][offset] = r_y;
|
||||
buf[1][2 * offset] = g_u;
|
||||
buf[0][offset] = r_y_h;
|
||||
buf[1][2 * offset] = g_u_s;
|
||||
buf[1][2 * offset + 1] = b_v;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_NV42:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
buf[1][2 * offset] = b_v;
|
||||
buf[1][2 * offset + 1] = g_u;
|
||||
buf[1][2 * offset + 1] = g_u_s;
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_YUYV:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
if (odd) {
|
||||
buf[0][1] = (buf[0][1] + g_u) / 2;
|
||||
buf[0][1] = (buf[0][1] + g_u_s) / 2;
|
||||
buf[0][3] = (buf[0][3] + b_v) / 2;
|
||||
break;
|
||||
}
|
||||
buf[0][1] = g_u;
|
||||
buf[0][1] = g_u_s;
|
||||
buf[0][3] = b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_UYVY:
|
||||
buf[0][offset + 1] = r_y;
|
||||
buf[0][offset + 1] = r_y_h;
|
||||
if (odd) {
|
||||
buf[0][0] = (buf[0][0] + g_u) / 2;
|
||||
buf[0][0] = (buf[0][0] + g_u_s) / 2;
|
||||
buf[0][2] = (buf[0][2] + b_v) / 2;
|
||||
break;
|
||||
}
|
||||
buf[0][0] = g_u;
|
||||
buf[0][0] = g_u_s;
|
||||
buf[0][2] = b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YVYU:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset] = r_y_h;
|
||||
if (odd) {
|
||||
buf[0][1] = (buf[0][1] + b_v) / 2;
|
||||
buf[0][3] = (buf[0][3] + g_u) / 2;
|
||||
buf[0][3] = (buf[0][3] + g_u_s) / 2;
|
||||
break;
|
||||
}
|
||||
buf[0][1] = b_v;
|
||||
buf[0][3] = g_u;
|
||||
buf[0][3] = g_u_s;
|
||||
break;
|
||||
case V4L2_PIX_FMT_VYUY:
|
||||
buf[0][offset + 1] = r_y;
|
||||
buf[0][offset + 1] = r_y_h;
|
||||
if (odd) {
|
||||
buf[0][0] = (buf[0][0] + b_v) / 2;
|
||||
buf[0][2] = (buf[0][2] + g_u) / 2;
|
||||
buf[0][2] = (buf[0][2] + g_u_s) / 2;
|
||||
break;
|
||||
}
|
||||
buf[0][0] = b_v;
|
||||
buf[0][2] = g_u;
|
||||
buf[0][2] = g_u_s;
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB332:
|
||||
buf[0][offset] = (r_y << 5) | (g_u << 2) | b_v;
|
||||
buf[0][offset] = (r_y_h << 5) | (g_u_s << 2) | b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_YUV565:
|
||||
case V4L2_PIX_FMT_RGB565:
|
||||
buf[0][offset] = (g_u << 5) | b_v;
|
||||
buf[0][offset + 1] = (r_y << 3) | (g_u >> 3);
|
||||
buf[0][offset] = (g_u_s << 5) | b_v;
|
||||
buf[0][offset + 1] = (r_y_h << 3) | (g_u_s >> 3);
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB565X:
|
||||
buf[0][offset] = (r_y << 3) | (g_u >> 3);
|
||||
buf[0][offset + 1] = (g_u << 5) | b_v;
|
||||
buf[0][offset] = (r_y_h << 3) | (g_u_s >> 3);
|
||||
buf[0][offset + 1] = (g_u_s << 5) | b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB444:
|
||||
case V4L2_PIX_FMT_XRGB444:
|
||||
@@ -1098,8 +1203,8 @@ static void gen_twopix(struct tpg_data *tpg,
|
||||
/* fall through */
|
||||
case V4L2_PIX_FMT_YUV444:
|
||||
case V4L2_PIX_FMT_ARGB444:
|
||||
buf[0][offset] = (g_u << 4) | b_v;
|
||||
buf[0][offset + 1] = (alpha & 0xf0) | r_y;
|
||||
buf[0][offset] = (g_u_s << 4) | b_v;
|
||||
buf[0][offset + 1] = (alpha & 0xf0) | r_y_h;
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB555:
|
||||
case V4L2_PIX_FMT_XRGB555:
|
||||
@@ -1107,42 +1212,45 @@ static void gen_twopix(struct tpg_data *tpg,
|
||||
/* fall through */
|
||||
case V4L2_PIX_FMT_YUV555:
|
||||
case V4L2_PIX_FMT_ARGB555:
|
||||
buf[0][offset] = (g_u << 5) | b_v;
|
||||
buf[0][offset + 1] = (alpha & 0x80) | (r_y << 2) | (g_u >> 3);
|
||||
buf[0][offset] = (g_u_s << 5) | b_v;
|
||||
buf[0][offset + 1] = (alpha & 0x80) | (r_y_h << 2)
|
||||
| (g_u_s >> 3);
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB555X:
|
||||
case V4L2_PIX_FMT_XRGB555X:
|
||||
alpha = 0;
|
||||
/* fall through */
|
||||
case V4L2_PIX_FMT_ARGB555X:
|
||||
buf[0][offset] = (alpha & 0x80) | (r_y << 2) | (g_u >> 3);
|
||||
buf[0][offset + 1] = (g_u << 5) | b_v;
|
||||
buf[0][offset] = (alpha & 0x80) | (r_y_h << 2) | (g_u_s >> 3);
|
||||
buf[0][offset + 1] = (g_u_s << 5) | b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB24:
|
||||
buf[0][offset] = r_y;
|
||||
buf[0][offset + 1] = g_u;
|
||||
case V4L2_PIX_FMT_HSV24:
|
||||
buf[0][offset] = r_y_h;
|
||||
buf[0][offset + 1] = g_u_s;
|
||||
buf[0][offset + 2] = b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_BGR24:
|
||||
buf[0][offset] = b_v;
|
||||
buf[0][offset + 1] = g_u;
|
||||
buf[0][offset + 2] = r_y;
|
||||
buf[0][offset + 1] = g_u_s;
|
||||
buf[0][offset + 2] = r_y_h;
|
||||
break;
|
||||
case V4L2_PIX_FMT_BGR666:
|
||||
buf[0][offset] = (b_v << 2) | (g_u >> 4);
|
||||
buf[0][offset + 1] = (g_u << 4) | (r_y >> 2);
|
||||
buf[0][offset + 2] = r_y << 6;
|
||||
buf[0][offset] = (b_v << 2) | (g_u_s >> 4);
|
||||
buf[0][offset + 1] = (g_u_s << 4) | (r_y_h >> 2);
|
||||
buf[0][offset + 2] = r_y_h << 6;
|
||||
buf[0][offset + 3] = 0;
|
||||
break;
|
||||
case V4L2_PIX_FMT_RGB32:
|
||||
case V4L2_PIX_FMT_XRGB32:
|
||||
case V4L2_PIX_FMT_HSV32:
|
||||
alpha = 0;
|
||||
/* fall through */
|
||||
case V4L2_PIX_FMT_YUV32:
|
||||
case V4L2_PIX_FMT_ARGB32:
|
||||
buf[0][offset] = alpha;
|
||||
buf[0][offset + 1] = r_y;
|
||||
buf[0][offset + 2] = g_u;
|
||||
buf[0][offset + 1] = r_y_h;
|
||||
buf[0][offset + 2] = g_u_s;
|
||||
buf[0][offset + 3] = b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_BGR32:
|
||||
@@ -1151,87 +1259,87 @@ static void gen_twopix(struct tpg_data *tpg,
|
||||
/* fall through */
|
||||
case V4L2_PIX_FMT_ABGR32:
|
||||
buf[0][offset] = b_v;
|
||||
buf[0][offset + 1] = g_u;
|
||||
buf[0][offset + 2] = r_y;
|
||||
buf[0][offset + 1] = g_u_s;
|
||||
buf[0][offset + 2] = r_y_h;
|
||||
buf[0][offset + 3] = alpha;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SBGGR8:
|
||||
buf[0][offset] = odd ? g_u : b_v;
|
||||
buf[1][offset] = odd ? r_y : g_u;
|
||||
buf[0][offset] = odd ? g_u_s : b_v;
|
||||
buf[1][offset] = odd ? r_y_h : g_u_s;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGBRG8:
|
||||
buf[0][offset] = odd ? b_v : g_u;
|
||||
buf[1][offset] = odd ? g_u : r_y;
|
||||
buf[0][offset] = odd ? b_v : g_u_s;
|
||||
buf[1][offset] = odd ? g_u_s : r_y_h;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGRBG8:
|
||||
buf[0][offset] = odd ? r_y : g_u;
|
||||
buf[1][offset] = odd ? g_u : b_v;
|
||||
buf[0][offset] = odd ? r_y_h : g_u_s;
|
||||
buf[1][offset] = odd ? g_u_s : b_v;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SRGGB8:
|
||||
buf[0][offset] = odd ? g_u : r_y;
|
||||
buf[1][offset] = odd ? b_v : g_u;
|
||||
buf[0][offset] = odd ? g_u_s : r_y_h;
|
||||
buf[1][offset] = odd ? b_v : g_u_s;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SBGGR10:
|
||||
buf[0][offset] = odd ? g_u << 2 : b_v << 2;
|
||||
buf[0][offset + 1] = odd ? g_u >> 6 : b_v >> 6;
|
||||
buf[1][offset] = odd ? r_y << 2 : g_u << 2;
|
||||
buf[1][offset + 1] = odd ? r_y >> 6 : g_u >> 6;
|
||||
buf[0][offset] = odd ? g_u_s << 2 : b_v << 2;
|
||||
buf[0][offset + 1] = odd ? g_u_s >> 6 : b_v >> 6;
|
||||
buf[1][offset] = odd ? r_y_h << 2 : g_u_s << 2;
|
||||
buf[1][offset + 1] = odd ? r_y_h >> 6 : g_u_s >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGBRG10:
|
||||
buf[0][offset] = odd ? b_v << 2 : g_u << 2;
|
||||
buf[0][offset + 1] = odd ? b_v >> 6 : g_u >> 6;
|
||||
buf[1][offset] = odd ? g_u << 2 : r_y << 2;
|
||||
buf[1][offset + 1] = odd ? g_u >> 6 : r_y >> 6;
|
||||
buf[0][offset] = odd ? b_v << 2 : g_u_s << 2;
|
||||
buf[0][offset + 1] = odd ? b_v >> 6 : g_u_s >> 6;
|
||||
buf[1][offset] = odd ? g_u_s << 2 : r_y_h << 2;
|
||||
buf[1][offset + 1] = odd ? g_u_s >> 6 : r_y_h >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGRBG10:
|
||||
buf[0][offset] = odd ? r_y << 2 : g_u << 2;
|
||||
buf[0][offset + 1] = odd ? r_y >> 6 : g_u >> 6;
|
||||
buf[1][offset] = odd ? g_u << 2 : b_v << 2;
|
||||
buf[1][offset + 1] = odd ? g_u >> 6 : b_v >> 6;
|
||||
buf[0][offset] = odd ? r_y_h << 2 : g_u_s << 2;
|
||||
buf[0][offset + 1] = odd ? r_y_h >> 6 : g_u_s >> 6;
|
||||
buf[1][offset] = odd ? g_u_s << 2 : b_v << 2;
|
||||
buf[1][offset + 1] = odd ? g_u_s >> 6 : b_v >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SRGGB10:
|
||||
buf[0][offset] = odd ? g_u << 2 : r_y << 2;
|
||||
buf[0][offset + 1] = odd ? g_u >> 6 : r_y >> 6;
|
||||
buf[1][offset] = odd ? b_v << 2 : g_u << 2;
|
||||
buf[1][offset + 1] = odd ? b_v >> 6 : g_u >> 6;
|
||||
buf[0][offset] = odd ? g_u_s << 2 : r_y_h << 2;
|
||||
buf[0][offset + 1] = odd ? g_u_s >> 6 : r_y_h >> 6;
|
||||
buf[1][offset] = odd ? b_v << 2 : g_u_s << 2;
|
||||
buf[1][offset + 1] = odd ? b_v >> 6 : g_u_s >> 6;
|
||||
buf[0][offset] |= (buf[0][offset] >> 2) & 3;
|
||||
buf[1][offset] |= (buf[1][offset] >> 2) & 3;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SBGGR12:
|
||||
buf[0][offset] = odd ? g_u << 4 : b_v << 4;
|
||||
buf[0][offset + 1] = odd ? g_u >> 4 : b_v >> 4;
|
||||
buf[1][offset] = odd ? r_y << 4 : g_u << 4;
|
||||
buf[1][offset + 1] = odd ? r_y >> 4 : g_u >> 4;
|
||||
buf[0][offset] = odd ? g_u_s << 4 : b_v << 4;
|
||||
buf[0][offset + 1] = odd ? g_u_s >> 4 : b_v >> 4;
|
||||
buf[1][offset] = odd ? r_y_h << 4 : g_u_s << 4;
|
||||
buf[1][offset + 1] = odd ? r_y_h >> 4 : g_u_s >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGBRG12:
|
||||
buf[0][offset] = odd ? b_v << 4 : g_u << 4;
|
||||
buf[0][offset + 1] = odd ? b_v >> 4 : g_u >> 4;
|
||||
buf[1][offset] = odd ? g_u << 4 : r_y << 4;
|
||||
buf[1][offset + 1] = odd ? g_u >> 4 : r_y >> 4;
|
||||
buf[0][offset] = odd ? b_v << 4 : g_u_s << 4;
|
||||
buf[0][offset + 1] = odd ? b_v >> 4 : g_u_s >> 4;
|
||||
buf[1][offset] = odd ? g_u_s << 4 : r_y_h << 4;
|
||||
buf[1][offset + 1] = odd ? g_u_s >> 4 : r_y_h >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SGRBG12:
|
||||
buf[0][offset] = odd ? r_y << 4 : g_u << 4;
|
||||
buf[0][offset + 1] = odd ? r_y >> 4 : g_u >> 4;
|
||||
buf[1][offset] = odd ? g_u << 4 : b_v << 4;
|
||||
buf[1][offset + 1] = odd ? g_u >> 4 : b_v >> 4;
|
||||
buf[0][offset] = odd ? r_y_h << 4 : g_u_s << 4;
|
||||
buf[0][offset + 1] = odd ? r_y_h >> 4 : g_u_s >> 4;
|
||||
buf[1][offset] = odd ? g_u_s << 4 : b_v << 4;
|
||||
buf[1][offset + 1] = odd ? g_u_s >> 4 : b_v >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
case V4L2_PIX_FMT_SRGGB12:
|
||||
buf[0][offset] = odd ? g_u << 4 : r_y << 4;
|
||||
buf[0][offset + 1] = odd ? g_u >> 4 : r_y >> 4;
|
||||
buf[1][offset] = odd ? b_v << 4 : g_u << 4;
|
||||
buf[1][offset + 1] = odd ? b_v >> 4 : g_u >> 4;
|
||||
buf[0][offset] = odd ? g_u_s << 4 : r_y_h << 4;
|
||||
buf[0][offset + 1] = odd ? g_u_s >> 4 : r_y_h >> 4;
|
||||
buf[1][offset] = odd ? b_v << 4 : g_u_s << 4;
|
||||
buf[1][offset + 1] = odd ? b_v >> 4 : g_u_s >> 4;
|
||||
buf[0][offset] |= (buf[0][offset] >> 4) & 0xf;
|
||||
buf[1][offset] |= (buf[1][offset] >> 4) & 0xf;
|
||||
break;
|
||||
@@ -1828,6 +1936,7 @@ static void tpg_recalc(struct tpg_data *tpg)
|
||||
tpg->recalc_lines = true;
|
||||
tpg->real_xfer_func = tpg->xfer_func;
|
||||
tpg->real_ycbcr_enc = tpg->ycbcr_enc;
|
||||
tpg->real_hsv_enc = tpg->hsv_enc;
|
||||
tpg->real_quantization = tpg->quantization;
|
||||
|
||||
if (tpg->xfer_func == V4L2_XFER_FUNC_DEFAULT)
|
||||
@@ -1840,7 +1949,8 @@ static void tpg_recalc(struct tpg_data *tpg)
|
||||
|
||||
if (tpg->quantization == V4L2_QUANTIZATION_DEFAULT)
|
||||
tpg->real_quantization =
|
||||
V4L2_MAP_QUANTIZATION_DEFAULT(!tpg->is_yuv,
|
||||
V4L2_MAP_QUANTIZATION_DEFAULT(
|
||||
tpg->color_enc != TGP_COLOR_ENC_YCBCR,
|
||||
tpg->colorspace, tpg->real_ycbcr_enc);
|
||||
|
||||
tpg_precalculate_colors(tpg);
|
||||
@@ -1887,11 +1997,28 @@ static int tpg_pattern_avg(const struct tpg_data *tpg,
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char *tpg_color_enc_str(enum tgp_color_enc
|
||||
color_enc)
|
||||
{
|
||||
switch (color_enc) {
|
||||
case TGP_COLOR_ENC_HSV:
|
||||
return "HSV";
|
||||
case TGP_COLOR_ENC_YCBCR:
|
||||
return "Y'CbCr";
|
||||
case TGP_COLOR_ENC_LUMA:
|
||||
return "Luma";
|
||||
case TGP_COLOR_ENC_RGB:
|
||||
default:
|
||||
return "R'G'B";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void tpg_log_status(struct tpg_data *tpg)
|
||||
{
|
||||
pr_info("tpg source WxH: %ux%u (%s)\n",
|
||||
tpg->src_width, tpg->src_height,
|
||||
tpg->is_yuv ? "YCbCr" : "RGB");
|
||||
tpg->src_width, tpg->src_height,
|
||||
tpg_color_enc_str(tpg->color_enc));
|
||||
pr_info("tpg field: %u\n", tpg->field);
|
||||
pr_info("tpg crop: %ux%u@%dx%d\n", tpg->crop.width, tpg->crop.height,
|
||||
tpg->crop.left, tpg->crop.top);
|
||||
@@ -1900,6 +2027,7 @@ void tpg_log_status(struct tpg_data *tpg)
|
||||
pr_info("tpg colorspace: %d\n", tpg->colorspace);
|
||||
pr_info("tpg transfer function: %d/%d\n", tpg->xfer_func, tpg->real_xfer_func);
|
||||
pr_info("tpg Y'CbCr encoding: %d/%d\n", tpg->ycbcr_enc, tpg->real_ycbcr_enc);
|
||||
pr_info("tpg HSV encoding: %d/%d\n", tpg->hsv_enc, tpg->real_hsv_enc);
|
||||
pr_info("tpg quantization: %d/%d\n", tpg->quantization, tpg->real_quantization);
|
||||
pr_info("tpg RGB range: %d/%d\n", tpg->rgb_range, tpg->real_rgb_range);
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
config DVB_MAX_ADAPTERS
|
||||
int "maximum number of DVB/ATSC adapters"
|
||||
depends on DVB_CORE
|
||||
default 8
|
||||
default 16
|
||||
range 1 255
|
||||
help
|
||||
Maximum number of DVB/ATSC adapters. Increasing this number
|
||||
@@ -13,7 +13,7 @@ config DVB_MAX_ADAPTERS
|
||||
if a much lower number of DVB/ATSC adapters is present.
|
||||
Only values in the range 4-32 are tested.
|
||||
|
||||
If you are unsure about this, use the default value 8
|
||||
If you are unsure about this, use the default value 16
|
||||
|
||||
config DVB_DYNAMIC_MINORS
|
||||
bool "Dynamic DVB minor allocation"
|
||||
@@ -27,3 +27,16 @@ config DVB_DYNAMIC_MINORS
|
||||
will be required to manage the device nodes.
|
||||
|
||||
If you are unsure about this, say N here.
|
||||
|
||||
config DVB_DEMUX_SECTION_LOSS_LOG
|
||||
bool "Enable DVB demux section packet loss log"
|
||||
depends on DVB_CORE
|
||||
default n
|
||||
help
|
||||
Enable extra log messages meant to detect packet loss
|
||||
inside the Kernel.
|
||||
|
||||
Should not be enabled on normal cases, as logs can
|
||||
be very verbose.
|
||||
|
||||
If you are unsure about this, say N here.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
dvb-net-$(CONFIG_DVB_NET) := dvb_net.o
|
||||
|
||||
dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \
|
||||
dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o \
|
||||
dvb_ca_en50221.o dvb_frontend.o \
|
||||
$(dvb-net-y) dvb_ringbuffer.o dvb_math.o
|
||||
|
||||
|
@@ -103,7 +103,6 @@ struct dmx_ts_feed {
|
||||
u16 pid,
|
||||
int type,
|
||||
enum dmx_ts_pes pes_type,
|
||||
size_t circular_buffer_size,
|
||||
ktime_t timeout);
|
||||
int (*start_filtering)(struct dmx_ts_feed *feed);
|
||||
int (*stop_filtering)(struct dmx_ts_feed *feed);
|
||||
@@ -181,7 +180,6 @@ struct dmx_section_feed {
|
||||
/* public: */
|
||||
int (*set)(struct dmx_section_feed *feed,
|
||||
u16 pid,
|
||||
size_t circular_buffer_size,
|
||||
int check_crc);
|
||||
int (*allocate_filter)(struct dmx_section_feed *feed,
|
||||
struct dmx_section_filter **filter);
|
||||
@@ -206,8 +204,7 @@ struct dmx_section_feed {
|
||||
* the &dmx_demux.
|
||||
* Any TS packets that match the filter settings are copied to a circular
|
||||
* buffer. The filtered TS packets are delivered to the client using this
|
||||
* callback function. The size of the circular buffer is controlled by the
|
||||
* circular_buffer_size parameter of the &dmx_ts_feed.@set function.
|
||||
* callback function.
|
||||
* It is expected that the @buffer1 and @buffer2 callback parameters point to
|
||||
* addresses within the circular buffer, but other implementations are also
|
||||
* possible. Note that the called party should not try to free the memory
|
||||
|
@@ -20,6 +20,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "dmxdev: " fmt
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -36,7 +38,11 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
|
||||
|
||||
#define dprintk if (debug) printk
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
static int dvb_dmxdev_buffer_write(struct dvb_ringbuffer *buf,
|
||||
const u8 *src, size_t len)
|
||||
@@ -50,7 +56,7 @@ static int dvb_dmxdev_buffer_write(struct dvb_ringbuffer *buf,
|
||||
|
||||
free = dvb_ringbuffer_free(buf);
|
||||
if (len > free) {
|
||||
dprintk("dmxdev: buffer overflow\n");
|
||||
dprintk("buffer overflow\n");
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
|
||||
@@ -126,7 +132,7 @@ static int dvb_dvr_open(struct inode *inode, struct file *file)
|
||||
struct dmxdev *dmxdev = dvbdev->priv;
|
||||
struct dmx_frontend *front;
|
||||
|
||||
dprintk("function : %s\n", __func__);
|
||||
dprintk("%s\n", __func__);
|
||||
|
||||
if (mutex_lock_interruptible(&dmxdev->mutex))
|
||||
return -ERESTARTSYS;
|
||||
@@ -258,7 +264,7 @@ static int dvb_dvr_set_buffer_size(struct dmxdev *dmxdev,
|
||||
void *newmem;
|
||||
void *oldmem;
|
||||
|
||||
dprintk("function : %s\n", __func__);
|
||||
dprintk("%s\n", __func__);
|
||||
|
||||
if (buf->size == size)
|
||||
return 0;
|
||||
@@ -367,7 +373,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
|
||||
return 0;
|
||||
}
|
||||
del_timer(&dmxdevfilter->timer);
|
||||
dprintk("dmxdev: section callback %*ph\n", 6, buffer1);
|
||||
dprintk("section callback %*ph\n", 6, buffer1);
|
||||
ret = dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer1,
|
||||
buffer1_len);
|
||||
if (ret == buffer1_len) {
|
||||
@@ -589,7 +595,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev,
|
||||
tsfeed = feed->ts;
|
||||
tsfeed->priv = filter;
|
||||
|
||||
ret = tsfeed->set(tsfeed, feed->pid, ts_type, ts_pes, 32768, timeout);
|
||||
ret = tsfeed->set(tsfeed, feed->pid, ts_type, ts_pes, timeout);
|
||||
if (ret < 0) {
|
||||
dmxdev->demux->release_ts_feed(dmxdev->demux, tsfeed);
|
||||
return ret;
|
||||
@@ -655,15 +661,15 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter)
|
||||
secfeed,
|
||||
dvb_dmxdev_section_callback);
|
||||
if (ret < 0) {
|
||||
printk("DVB (%s): could not alloc feed\n",
|
||||
pr_err("DVB (%s): could not alloc feed\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = (*secfeed)->set(*secfeed, para->pid, 32768,
|
||||
ret = (*secfeed)->set(*secfeed, para->pid,
|
||||
(para->flags & DMX_CHECK_CRC) ? 1 : 0);
|
||||
if (ret < 0) {
|
||||
printk("DVB (%s): could not set feed\n",
|
||||
pr_err("DVB (%s): could not set feed\n",
|
||||
__func__);
|
||||
dvb_dmxdev_feed_restart(filter);
|
||||
return ret;
|
||||
@@ -844,7 +850,7 @@ static int dvb_dmxdev_filter_set(struct dmxdev *dmxdev,
|
||||
struct dmxdev_filter *dmxdevfilter,
|
||||
struct dmx_sct_filter_params *params)
|
||||
{
|
||||
dprintk("function : %s, PID=0x%04x, flags=%02x, timeout=%d\n",
|
||||
dprintk("%s: PID=0x%04x, flags=%02x, timeout=%d\n",
|
||||
__func__, params->pid, params->flags, params->timeout);
|
||||
|
||||
dvb_dmxdev_filter_stop(dmxdevfilter);
|
||||
@@ -1184,7 +1190,7 @@ static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
|
||||
struct dmxdev *dmxdev = dvbdev->priv;
|
||||
unsigned int mask = 0;
|
||||
|
||||
dprintk("function : %s\n", __func__);
|
||||
dprintk("%s\n", __func__);
|
||||
|
||||
if (dmxdev->exit)
|
||||
return POLLERR;
|
||||
|
@@ -262,6 +262,7 @@
|
||||
#define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI 0x3012
|
||||
#define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI_2 0x3015
|
||||
#define USB_PID_TECHNOTREND_TVSTICK_CT2_4400 0x3014
|
||||
#define USB_PID_TECHNOTREND_CONNECT_S2_4650_CI 0x3017
|
||||
#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a
|
||||
#define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2 0x0081
|
||||
#define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058
|
||||
@@ -411,4 +412,5 @@
|
||||
#define USB_PID_SVEON_STV27 0xd3af
|
||||
#define USB_PID_TURBOX_DTT_2000 0xd3a4
|
||||
#define USB_PID_WINTV_SOLOHD 0x0264
|
||||
#define USB_PID_EVOLVEO_XTRATV_STICK 0xa115
|
||||
#endif
|
||||
|
@@ -28,6 +28,8 @@
|
||||
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "dvb_ca_en50221: " fmt
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/list.h>
|
||||
@@ -46,7 +48,10 @@ static int dvb_ca_en50221_debug;
|
||||
module_param_named(cam_debug, dvb_ca_en50221_debug, int, 0644);
|
||||
MODULE_PARM_DESC(cam_debug, "enable verbose debug messages");
|
||||
|
||||
#define dprintk if (dvb_ca_en50221_debug) printk
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (dvb_ca_en50221_debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg);\
|
||||
} while (0)
|
||||
|
||||
#define INIT_TIMEOUT_SECS 10
|
||||
|
||||
@@ -166,7 +171,7 @@ static void dvb_ca_private_free(struct dvb_ca_private *ca)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
dvb_unregister_device(ca->dvbdev);
|
||||
dvb_free_device(ca->dvbdev);
|
||||
for (i = 0; i < ca->slot_count; i++)
|
||||
vfree(ca->slot_info[i].rx_buffer.data);
|
||||
|
||||
@@ -298,7 +303,8 @@ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private *ca, int slot,
|
||||
|
||||
/* if we got the flags, it was successful! */
|
||||
if (res & waitfor) {
|
||||
dprintk("%s succeeded timeout:%lu\n", __func__, jiffies - start);
|
||||
dprintk("%s succeeded timeout:%lu\n",
|
||||
__func__, jiffies - start);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -519,8 +525,9 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
|
||||
|
||||
/* is it a version we support? */
|
||||
if (strncmp(dvb_str + 8, "1.00", 4)) {
|
||||
printk("dvb_ca adapter %d: Unsupported DVB CAM module version %c%c%c%c\n",
|
||||
ca->dvbdev->adapter->num, dvb_str[8], dvb_str[9], dvb_str[10], dvb_str[11]);
|
||||
pr_err("dvb_ca adapter %d: Unsupported DVB CAM module version %c%c%c%c\n",
|
||||
ca->dvbdev->adapter->num, dvb_str[8], dvb_str[9],
|
||||
dvb_str[10], dvb_str[11]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -557,8 +564,8 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
|
||||
break;
|
||||
|
||||
default: /* Unknown tuple type - just skip this tuple and move to the next one */
|
||||
dprintk("dvb_ca: Skipping unknown tuple type:0x%x length:0x%x\n", tupleType,
|
||||
tupleLength);
|
||||
dprintk("dvb_ca: Skipping unknown tuple type:0x%x length:0x%x\n",
|
||||
tupleType, tupleLength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -567,7 +574,8 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
|
||||
return -EINVAL;
|
||||
|
||||
dprintk("Valid DVB CAM detected MANID:%x DEVID:%x CONFIGBASE:0x%x CONFIGOPTION:0x%x\n",
|
||||
manfid, devid, ca->slot_info[slot].config_base, ca->slot_info[slot].config_option);
|
||||
manfid, devid, ca->slot_info[slot].config_base,
|
||||
ca->slot_info[slot].config_option);
|
||||
|
||||
// success!
|
||||
return 0;
|
||||
@@ -661,14 +669,15 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb
|
||||
/* check it will fit */
|
||||
if (ebuf == NULL) {
|
||||
if (bytes_read > ca->slot_info[slot].link_buf_size) {
|
||||
printk("dvb_ca adapter %d: CAM tried to send a buffer larger than the link buffer size (%i > %i)!\n",
|
||||
ca->dvbdev->adapter->num, bytes_read, ca->slot_info[slot].link_buf_size);
|
||||
pr_err("dvb_ca adapter %d: CAM tried to send a buffer larger than the link buffer size (%i > %i)!\n",
|
||||
ca->dvbdev->adapter->num, bytes_read,
|
||||
ca->slot_info[slot].link_buf_size);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_LINKINIT;
|
||||
status = -EIO;
|
||||
goto exit;
|
||||
}
|
||||
if (bytes_read < 2) {
|
||||
printk("dvb_ca adapter %d: CAM sent a buffer that was less than 2 bytes!\n",
|
||||
pr_err("dvb_ca adapter %d: CAM sent a buffer that was less than 2 bytes!\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_LINKINIT;
|
||||
status = -EIO;
|
||||
@@ -676,7 +685,7 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb
|
||||
}
|
||||
} else {
|
||||
if (bytes_read > ecount) {
|
||||
printk("dvb_ca adapter %d: CAM tried to send a buffer larger than the ecount size!\n",
|
||||
pr_err("dvb_ca adapter %d: CAM tried to send a buffer larger than the ecount size!\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
status = -EIO;
|
||||
goto exit;
|
||||
@@ -1062,7 +1071,7 @@ static int dvb_ca_en50221_thread(void *data)
|
||||
|
||||
case DVB_CA_SLOTSTATE_WAITREADY:
|
||||
if (time_after(jiffies, ca->slot_info[slot].timeout)) {
|
||||
printk("dvb_ca adaptor %d: PC card did not respond :(\n",
|
||||
pr_err("dvb_ca adaptor %d: PC card did not respond :(\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
@@ -1084,14 +1093,14 @@ static int dvb_ca_en50221_thread(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
printk("dvb_ca adapter %d: Invalid PC card inserted :(\n",
|
||||
pr_err("dvb_ca adapter %d: Invalid PC card inserted :(\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
break;
|
||||
}
|
||||
if (dvb_ca_en50221_set_configoption(ca, slot) != 0) {
|
||||
printk("dvb_ca adapter %d: Unable to initialise CAM :(\n",
|
||||
pr_err("dvb_ca adapter %d: Unable to initialise CAM :(\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
@@ -1099,7 +1108,7 @@ static int dvb_ca_en50221_thread(void *data)
|
||||
}
|
||||
if (ca->pub->write_cam_control(ca->pub, slot,
|
||||
CTRLIF_COMMAND, CMDREG_RS) != 0) {
|
||||
printk("dvb_ca adapter %d: Unable to reset CAM IF\n",
|
||||
pr_err("dvb_ca adapter %d: Unable to reset CAM IF\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
@@ -1114,7 +1123,7 @@ static int dvb_ca_en50221_thread(void *data)
|
||||
|
||||
case DVB_CA_SLOTSTATE_WAITFR:
|
||||
if (time_after(jiffies, ca->slot_info[slot].timeout)) {
|
||||
printk("dvb_ca adapter %d: DVB CAM did not respond :(\n",
|
||||
pr_err("dvb_ca adapter %d: DVB CAM did not respond :(\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
@@ -1141,7 +1150,8 @@ static int dvb_ca_en50221_thread(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
printk("dvb_ca adapter %d: DVB CAM link initialisation failed :(\n", ca->dvbdev->adapter->num);
|
||||
pr_err("dvb_ca adapter %d: DVB CAM link initialisation failed :(\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
break;
|
||||
@@ -1150,7 +1160,8 @@ static int dvb_ca_en50221_thread(void *data)
|
||||
if (ca->slot_info[slot].rx_buffer.data == NULL) {
|
||||
rxbuf = vmalloc(RX_BUFFER_SIZE);
|
||||
if (rxbuf == NULL) {
|
||||
printk("dvb_ca adapter %d: Unable to allocate CAM rx buffer :(\n", ca->dvbdev->adapter->num);
|
||||
pr_err("dvb_ca adapter %d: Unable to allocate CAM rx buffer :(\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_INVALID;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
break;
|
||||
@@ -1161,7 +1172,8 @@ static int dvb_ca_en50221_thread(void *data)
|
||||
ca->pub->slot_ts_enable(ca->pub, slot);
|
||||
ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_RUNNING;
|
||||
dvb_ca_en50221_thread_update_delay(ca);
|
||||
printk("dvb_ca adapter %d: DVB CAM detected and initialised successfully\n", ca->dvbdev->adapter->num);
|
||||
pr_err("dvb_ca adapter %d: DVB CAM detected and initialised successfully\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
break;
|
||||
|
||||
case DVB_CA_SLOTSTATE_RUNNING:
|
||||
@@ -1497,7 +1509,8 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf,
|
||||
pktlen = 2;
|
||||
do {
|
||||
if (idx == -1) {
|
||||
printk("dvb_ca adapter %d: BUG: read packet ended before last_fragment encountered\n", ca->dvbdev->adapter->num);
|
||||
pr_err("dvb_ca adapter %d: BUG: read packet ended before last_fragment encountered\n",
|
||||
ca->dvbdev->adapter->num);
|
||||
status = -EIO;
|
||||
goto exit;
|
||||
}
|
||||
@@ -1755,8 +1768,8 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
|
||||
ca->dvbdev->adapter->num, ca->dvbdev->id);
|
||||
if (IS_ERR(ca->thread)) {
|
||||
ret = PTR_ERR(ca->thread);
|
||||
printk("dvb_ca_init: failed to start kernel_thread (%d)\n",
|
||||
ret);
|
||||
pr_err("dvb_ca_init: failed to start kernel_thread (%d)\n",
|
||||
ret);
|
||||
goto unregister_device;
|
||||
}
|
||||
return 0;
|
||||
@@ -1794,6 +1807,7 @@ void dvb_ca_en50221_release(struct dvb_ca_en50221 *pubca)
|
||||
for (i = 0; i < ca->slot_count; i++) {
|
||||
dvb_ca_en50221_slot_shutdown(ca, i);
|
||||
}
|
||||
dvb_remove_device(ca->dvbdev);
|
||||
dvb_ca_private_put(ca);
|
||||
pubca->private = NULL;
|
||||
}
|
||||
|
@@ -21,6 +21,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "dvb_demux: " fmt
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -34,12 +36,6 @@
|
||||
|
||||
#include "dvb_demux.h"
|
||||
|
||||
#define NOBUFS
|
||||
/*
|
||||
** #define DVB_DEMUX_SECTION_LOSS_LOG to monitor payload loss in the syslog
|
||||
*/
|
||||
// #define DVB_DEMUX_SECTION_LOSS_LOG
|
||||
|
||||
static int dvb_demux_tscheck;
|
||||
module_param(dvb_demux_tscheck, int, 0644);
|
||||
MODULE_PARM_DESC(dvb_demux_tscheck,
|
||||
@@ -55,10 +51,13 @@ module_param(dvb_demux_feed_err_pkts, int, 0644);
|
||||
MODULE_PARM_DESC(dvb_demux_feed_err_pkts,
|
||||
"when set to 0, drop packets with the TEI bit set (1 by default)");
|
||||
|
||||
#define dprintk_tscheck(x...) do { \
|
||||
if (dvb_demux_tscheck && printk_ratelimit()) \
|
||||
printk(x); \
|
||||
} while (0)
|
||||
#define dprintk(fmt, arg...) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg)
|
||||
|
||||
#define dprintk_tscheck(x...) do { \
|
||||
if (dvb_demux_tscheck && printk_ratelimit()) \
|
||||
dprintk(x); \
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************
|
||||
* static inlined helper functions
|
||||
@@ -109,21 +108,23 @@ static inline int dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed,
|
||||
{
|
||||
int count = payload(buf);
|
||||
int p;
|
||||
//int ccok;
|
||||
//u8 cc;
|
||||
#ifdef CONFIG_DVB_DEMUX_SECTION_LOSS_LOG
|
||||
int ccok;
|
||||
u8 cc;
|
||||
#endif
|
||||
|
||||
if (count == 0)
|
||||
return -1;
|
||||
|
||||
p = 188 - count;
|
||||
|
||||
/*
|
||||
#ifdef CONFIG_DVB_DEMUX_SECTION_LOSS_LOG
|
||||
cc = buf[3] & 0x0f;
|
||||
ccok = ((feed->cc + 1) & 0x0f) == cc;
|
||||
feed->cc = cc;
|
||||
if (!ccok)
|
||||
printk("missed packet!\n");
|
||||
*/
|
||||
dprintk("missed packet!\n");
|
||||
#endif
|
||||
|
||||
if (buf[1] & 0x40) // PUSI ?
|
||||
feed->peslen = 0xfffa;
|
||||
@@ -189,7 +190,7 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed)
|
||||
{
|
||||
struct dmx_section_feed *sec = &feed->feed.sec;
|
||||
|
||||
#ifdef DVB_DEMUX_SECTION_LOSS_LOG
|
||||
#ifdef CONFIG_DVB_DEMUX_SECTION_LOSS_LOG
|
||||
if (sec->secbufp < sec->tsfeedp) {
|
||||
int i, n = sec->tsfeedp - sec->secbufp;
|
||||
|
||||
@@ -199,12 +200,12 @@ static void dvb_dmx_swfilter_section_new(struct dvb_demux_feed *feed)
|
||||
* but just first and last.
|
||||
*/
|
||||
if (sec->secbuf[0] != 0xff || sec->secbuf[n - 1] != 0xff) {
|
||||
printk("dvb_demux.c section ts padding loss: %d/%d\n",
|
||||
dprintk("dvb_demux.c section ts padding loss: %d/%d\n",
|
||||
n, sec->tsfeedp);
|
||||
printk("dvb_demux.c pad data:");
|
||||
dprintk("dvb_demux.c pad data:");
|
||||
for (i = 0; i < n; i++)
|
||||
printk(" %02x", sec->secbuf[i]);
|
||||
printk("\n");
|
||||
pr_cont(" %02x", sec->secbuf[i]);
|
||||
pr_cont("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -242,8 +243,8 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
|
||||
return 0;
|
||||
|
||||
if (sec->tsfeedp + len > DMX_MAX_SECFEED_SIZE) {
|
||||
#ifdef DVB_DEMUX_SECTION_LOSS_LOG
|
||||
printk("dvb_demux.c section buffer full loss: %d/%d\n",
|
||||
#ifdef CONFIG_DVB_DEMUX_SECTION_LOSS_LOG
|
||||
dprintk("dvb_demux.c section buffer full loss: %d/%d\n",
|
||||
sec->tsfeedp + len - DMX_MAX_SECFEED_SIZE,
|
||||
DMX_MAX_SECFEED_SIZE);
|
||||
#endif
|
||||
@@ -276,9 +277,9 @@ static int dvb_dmx_swfilter_section_copy_dump(struct dvb_demux_feed *feed,
|
||||
/* dump [secbuf .. secbuf+seclen) */
|
||||
if (feed->pusi_seen)
|
||||
dvb_dmx_swfilter_section_feed(feed);
|
||||
#ifdef DVB_DEMUX_SECTION_LOSS_LOG
|
||||
#ifdef CONFIG_DVB_DEMUX_SECTION_LOSS_LOG
|
||||
else
|
||||
printk("dvb_demux.c pusi not seen, discarding section data\n");
|
||||
dprintk("dvb_demux.c pusi not seen, discarding section data\n");
|
||||
#endif
|
||||
sec->secbufp += seclen; /* secbufp and secbuf moving together is */
|
||||
sec->secbuf += seclen; /* redundant but saves pointer arithmetic */
|
||||
@@ -312,9 +313,9 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,
|
||||
}
|
||||
|
||||
if (!ccok || dc_i) {
|
||||
#ifdef DVB_DEMUX_SECTION_LOSS_LOG
|
||||
printk("dvb_demux.c discontinuity detected %d bytes lost\n",
|
||||
count);
|
||||
#ifdef CONFIG_DVB_DEMUX_SECTION_LOSS_LOG
|
||||
dprintk("dvb_demux.c discontinuity detected %d bytes lost\n",
|
||||
count);
|
||||
/*
|
||||
* those bytes under sume circumstances will again be reported
|
||||
* in the following dvb_dmx_swfilter_section_new
|
||||
@@ -344,9 +345,10 @@ static int dvb_dmx_swfilter_section_packet(struct dvb_demux_feed *feed,
|
||||
dvb_dmx_swfilter_section_copy_dump(feed, after,
|
||||
after_len);
|
||||
}
|
||||
#ifdef DVB_DEMUX_SECTION_LOSS_LOG
|
||||
#ifdef CONFIG_DVB_DEMUX_SECTION_LOSS_LOG
|
||||
else if (count > 0)
|
||||
printk("dvb_demux.c PUSI=1 but %d bytes lost\n", count);
|
||||
dprintk("dvb_demux.c PUSI=1 but %d bytes lost\n",
|
||||
count);
|
||||
#endif
|
||||
} else {
|
||||
/* PUSI=0 (is not set), no section boundary */
|
||||
@@ -415,9 +417,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
|
||||
1024);
|
||||
speed_timedelta = ktime_ms_delta(cur_time,
|
||||
demux->speed_last_time);
|
||||
printk(KERN_INFO "TS speed %llu Kbits/sec \n",
|
||||
div64_u64(speed_bytes,
|
||||
speed_timedelta));
|
||||
dprintk("TS speed %llu Kbits/sec \n",
|
||||
div64_u64(speed_bytes,
|
||||
speed_timedelta));
|
||||
}
|
||||
|
||||
demux->speed_last_time = cur_time;
|
||||
@@ -426,8 +428,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
|
||||
}
|
||||
|
||||
if (buf[1] & 0x80) {
|
||||
dprintk_tscheck("TEI detected. "
|
||||
"PID=0x%x data1=0x%x\n",
|
||||
dprintk_tscheck("TEI detected. PID=0x%x data1=0x%x\n",
|
||||
pid, buf[1]);
|
||||
/* data in this packet can't be trusted - drop it unless
|
||||
* module option dvb_demux_feed_err_pkts is set */
|
||||
@@ -635,7 +636,7 @@ static void dvb_demux_feed_add(struct dvb_demux_feed *feed)
|
||||
{
|
||||
spin_lock_irq(&feed->demux->lock);
|
||||
if (dvb_demux_feed_find(feed)) {
|
||||
printk(KERN_ERR "%s: feed already in list (type=%x state=%x pid=%x)\n",
|
||||
pr_err("%s: feed already in list (type=%x state=%x pid=%x)\n",
|
||||
__func__, feed->type, feed->state, feed->pid);
|
||||
goto out;
|
||||
}
|
||||
@@ -649,7 +650,7 @@ static void dvb_demux_feed_del(struct dvb_demux_feed *feed)
|
||||
{
|
||||
spin_lock_irq(&feed->demux->lock);
|
||||
if (!(dvb_demux_feed_find(feed))) {
|
||||
printk(KERN_ERR "%s: feed not in list (type=%x state=%x pid=%x)\n",
|
||||
pr_err("%s: feed not in list (type=%x state=%x pid=%x)\n",
|
||||
__func__, feed->type, feed->state, feed->pid);
|
||||
goto out;
|
||||
}
|
||||
@@ -660,8 +661,7 @@ out:
|
||||
}
|
||||
|
||||
static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type,
|
||||
enum dmx_ts_pes pes_type,
|
||||
size_t circular_buffer_size, ktime_t timeout)
|
||||
enum dmx_ts_pes pes_type, ktime_t timeout)
|
||||
{
|
||||
struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed;
|
||||
struct dvb_demux *demux = feed->demux;
|
||||
@@ -691,23 +691,10 @@ static int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type,
|
||||
dvb_demux_feed_add(feed);
|
||||
|
||||
feed->pid = pid;
|
||||
feed->buffer_size = circular_buffer_size;
|
||||
feed->timeout = timeout;
|
||||
feed->ts_type = ts_type;
|
||||
feed->pes_type = pes_type;
|
||||
|
||||
if (feed->buffer_size) {
|
||||
#ifdef NOBUFS
|
||||
feed->buffer = NULL;
|
||||
#else
|
||||
feed->buffer = vmalloc(feed->buffer_size);
|
||||
if (!feed->buffer) {
|
||||
mutex_unlock(&demux->mutex);
|
||||
return -ENOMEM;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
feed->state = DMX_STATE_READY;
|
||||
mutex_unlock(&demux->mutex);
|
||||
|
||||
@@ -796,7 +783,6 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
|
||||
feed->demux = demux;
|
||||
feed->pid = 0xffff;
|
||||
feed->peslen = 0xfffa;
|
||||
feed->buffer = NULL;
|
||||
|
||||
(*ts_feed) = &feed->feed.ts;
|
||||
(*ts_feed)->parent = dmx;
|
||||
@@ -833,10 +819,6 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx,
|
||||
mutex_unlock(&demux->mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
#ifndef NOBUFS
|
||||
vfree(feed->buffer);
|
||||
feed->buffer = NULL;
|
||||
#endif
|
||||
|
||||
feed->state = DMX_STATE_FREE;
|
||||
feed->filter->state = DMX_STATE_FREE;
|
||||
@@ -888,8 +870,7 @@ static int dmx_section_feed_allocate_filter(struct dmx_section_feed *feed,
|
||||
}
|
||||
|
||||
static int dmx_section_feed_set(struct dmx_section_feed *feed,
|
||||
u16 pid, size_t circular_buffer_size,
|
||||
int check_crc)
|
||||
u16 pid, int check_crc)
|
||||
{
|
||||
struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
|
||||
struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
|
||||
@@ -903,19 +884,8 @@ static int dmx_section_feed_set(struct dmx_section_feed *feed,
|
||||
dvb_demux_feed_add(dvbdmxfeed);
|
||||
|
||||
dvbdmxfeed->pid = pid;
|
||||
dvbdmxfeed->buffer_size = circular_buffer_size;
|
||||
dvbdmxfeed->feed.sec.check_crc = check_crc;
|
||||
|
||||
#ifdef NOBUFS
|
||||
dvbdmxfeed->buffer = NULL;
|
||||
#else
|
||||
dvbdmxfeed->buffer = vmalloc(dvbdmxfeed->buffer_size);
|
||||
if (!dvbdmxfeed->buffer) {
|
||||
mutex_unlock(&dvbdmx->mutex);
|
||||
return -ENOMEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
dvbdmxfeed->state = DMX_STATE_READY;
|
||||
mutex_unlock(&dvbdmx->mutex);
|
||||
return 0;
|
||||
@@ -1074,7 +1044,6 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux,
|
||||
dvbdmxfeed->feed.sec.secbufp = dvbdmxfeed->feed.sec.seclen = 0;
|
||||
dvbdmxfeed->feed.sec.tsfeedp = 0;
|
||||
dvbdmxfeed->filter = NULL;
|
||||
dvbdmxfeed->buffer = NULL;
|
||||
|
||||
(*feed) = &dvbdmxfeed->feed.sec;
|
||||
(*feed)->is_filtering = 0;
|
||||
@@ -1103,10 +1072,6 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux,
|
||||
mutex_unlock(&dvbdmx->mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
#ifndef NOBUFS
|
||||
vfree(dvbdmxfeed->buffer);
|
||||
dvbdmxfeed->buffer = NULL;
|
||||
#endif
|
||||
dvbdmxfeed->state = DMX_STATE_FREE;
|
||||
|
||||
dvb_demux_feed_del(dvbdmxfeed);
|
||||
@@ -1268,7 +1233,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
|
||||
|
||||
dvbdemux->cnt_storage = vmalloc(MAX_PID + 1);
|
||||
if (!dvbdemux->cnt_storage)
|
||||
printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n");
|
||||
pr_warn("Couldn't allocate memory for TS/TEI check. Disabling it\n");
|
||||
|
||||
INIT_LIST_HEAD(&dvbdemux->frontend_list);
|
||||
|
||||
|
@@ -80,8 +80,6 @@ struct dvb_demux_feed {
|
||||
int type;
|
||||
int state;
|
||||
u16 pid;
|
||||
u8 *buffer;
|
||||
int buffer_size;
|
||||
|
||||
ktime_t timeout;
|
||||
struct dvb_demux_filter *filter;
|
||||
|
@@ -1,603 +0,0 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include "dvb_filter.h"
|
||||
|
||||
#if 0
|
||||
static unsigned int bitrates[3][16] =
|
||||
{{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,0},
|
||||
{0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,0},
|
||||
{0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}};
|
||||
#endif
|
||||
|
||||
static u32 freq[4] = {480, 441, 320, 0};
|
||||
|
||||
static unsigned int ac3_bitrates[32] =
|
||||
{32,40,48,56,64,80,96,112,128,160,192,224,256,320,384,448,512,576,640,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
|
||||
static u32 ac3_frames[3][32] =
|
||||
{{64,80,96,112,128,160,192,224,256,320,384,448,512,640,768,896,1024,
|
||||
1152,1280,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{69,87,104,121,139,174,208,243,278,348,417,487,557,696,835,975,1114,
|
||||
1253,1393,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
||||
{96,120,144,168,192,240,288,336,384,480,576,672,768,960,1152,1344,
|
||||
1536,1728,1920,0,0,0,0,0,0,0,0,0,0,0,0,0}};
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
static void setup_ts2pes(ipack *pa, ipack *pv, u16 *pida, u16 *pidv,
|
||||
void (*pes_write)(u8 *buf, int count, void *data),
|
||||
void *priv)
|
||||
{
|
||||
dvb_filter_ipack_init(pa, IPACKS, pes_write);
|
||||
dvb_filter_ipack_init(pv, IPACKS, pes_write);
|
||||
pa->pid = pida;
|
||||
pv->pid = pidv;
|
||||
pa->data = priv;
|
||||
pv->data = priv;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void ts_to_pes(ipack *p, u8 *buf) // don't need count (=188)
|
||||
{
|
||||
u8 off = 0;
|
||||
|
||||
if (!buf || !p ){
|
||||
printk("NULL POINTER IDIOT\n");
|
||||
return;
|
||||
}
|
||||
if (buf[1]&PAY_START) {
|
||||
if (p->plength == MMAX_PLENGTH-6 && p->found>6){
|
||||
p->plength = p->found-6;
|
||||
p->found = 0;
|
||||
send_ipack(p);
|
||||
dvb_filter_ipack_reset(p);
|
||||
}
|
||||
}
|
||||
if (buf[3] & ADAPT_FIELD) { // adaptation field?
|
||||
off = buf[4] + 1;
|
||||
if (off+4 > 187) return;
|
||||
}
|
||||
dvb_filter_instant_repack(buf+4+off, TS_SIZE-4-off, p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* needs 5 byte input, returns picture coding type*/
|
||||
static int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, int pr)
|
||||
{
|
||||
u8 pct;
|
||||
|
||||
if (pr) printk( "Pic header: ");
|
||||
pic->temporal_reference[field] = (( headr[0] << 2 ) |
|
||||
(headr[1] & 0x03) )& 0x03ff;
|
||||
if (pr) printk( " temp ref: 0x%04x", pic->temporal_reference[field]);
|
||||
|
||||
pct = ( headr[1] >> 2 ) & 0x07;
|
||||
pic->picture_coding_type[field] = pct;
|
||||
if (pr) {
|
||||
switch(pct){
|
||||
case I_FRAME:
|
||||
printk( " I-FRAME");
|
||||
break;
|
||||
case B_FRAME:
|
||||
printk( " B-FRAME");
|
||||
break;
|
||||
case P_FRAME:
|
||||
printk( " P-FRAME");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pic->vinfo.vbv_delay = (( headr[1] >> 5 ) | ( headr[2] << 3) |
|
||||
( (headr[3] & 0x1F) << 11) ) & 0xffff;
|
||||
|
||||
if (pr) printk( " vbv delay: 0x%04x", pic->vinfo.vbv_delay);
|
||||
|
||||
pic->picture_header_parameter = ( headr[3] & 0xe0 ) |
|
||||
((headr[4] & 0x80) >> 3);
|
||||
|
||||
if ( pct == B_FRAME ){
|
||||
pic->picture_header_parameter |= ( headr[4] >> 3 ) & 0x0f;
|
||||
}
|
||||
if (pr) printk( " pic head param: 0x%x",
|
||||
pic->picture_header_parameter);
|
||||
|
||||
return pct;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* needs 4 byte input */
|
||||
static int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr)
|
||||
{
|
||||
if (pr) printk("GOP header: ");
|
||||
|
||||
pic->time_code = (( headr[0] << 17 ) | ( headr[1] << 9) |
|
||||
( headr[2] << 1 ) | (headr[3] &0x01)) & 0x1ffffff;
|
||||
|
||||
if (pr) printk(" time: %d:%d.%d ", (headr[0]>>2)& 0x1F,
|
||||
((headr[0]<<4)& 0x30)| ((headr[1]>>4)& 0x0F),
|
||||
((headr[1]<<3)& 0x38)| ((headr[2]>>5)& 0x0F));
|
||||
|
||||
if ( ( headr[3] & 0x40 ) != 0 ){
|
||||
pic->closed_gop = 1;
|
||||
} else {
|
||||
pic->closed_gop = 0;
|
||||
}
|
||||
if (pr) printk("closed: %d", pic->closed_gop);
|
||||
|
||||
if ( ( headr[3] & 0x20 ) != 0 ){
|
||||
pic->broken_link = 1;
|
||||
} else {
|
||||
pic->broken_link = 0;
|
||||
}
|
||||
if (pr) printk(" broken: %d\n", pic->broken_link);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* needs 8 byte input */
|
||||
static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
|
||||
{
|
||||
int sw;
|
||||
int form = -1;
|
||||
|
||||
if (pr) printk("Reading sequence header\n");
|
||||
|
||||
vi->horizontal_size = ((headr[1] &0xF0) >> 4) | (headr[0] << 4);
|
||||
vi->vertical_size = ((headr[1] &0x0F) << 8) | (headr[2]);
|
||||
|
||||
sw = (int)((headr[3]&0xF0) >> 4) ;
|
||||
|
||||
switch( sw ){
|
||||
case 1:
|
||||
if (pr)
|
||||
printk("Videostream: ASPECT: 1:1");
|
||||
vi->aspect_ratio = 100;
|
||||
break;
|
||||
case 2:
|
||||
if (pr)
|
||||
printk("Videostream: ASPECT: 4:3");
|
||||
vi->aspect_ratio = 133;
|
||||
break;
|
||||
case 3:
|
||||
if (pr)
|
||||
printk("Videostream: ASPECT: 16:9");
|
||||
vi->aspect_ratio = 177;
|
||||
break;
|
||||
case 4:
|
||||
if (pr)
|
||||
printk("Videostream: ASPECT: 2.21:1");
|
||||
vi->aspect_ratio = 221;
|
||||
break;
|
||||
|
||||
case 5 ... 15:
|
||||
if (pr)
|
||||
printk("Videostream: ASPECT: reserved");
|
||||
vi->aspect_ratio = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
vi->aspect_ratio = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pr)
|
||||
printk(" Size = %dx%d",vi->horizontal_size,vi->vertical_size);
|
||||
|
||||
sw = (int)(headr[3]&0x0F);
|
||||
|
||||
switch ( sw ) {
|
||||
case 1:
|
||||
if (pr)
|
||||
printk(" FRate: 23.976 fps");
|
||||
vi->framerate = 23976;
|
||||
form = -1;
|
||||
break;
|
||||
case 2:
|
||||
if (pr)
|
||||
printk(" FRate: 24 fps");
|
||||
vi->framerate = 24000;
|
||||
form = -1;
|
||||
break;
|
||||
case 3:
|
||||
if (pr)
|
||||
printk(" FRate: 25 fps");
|
||||
vi->framerate = 25000;
|
||||
form = VIDEO_MODE_PAL;
|
||||
break;
|
||||
case 4:
|
||||
if (pr)
|
||||
printk(" FRate: 29.97 fps");
|
||||
vi->framerate = 29970;
|
||||
form = VIDEO_MODE_NTSC;
|
||||
break;
|
||||
case 5:
|
||||
if (pr)
|
||||
printk(" FRate: 30 fps");
|
||||
vi->framerate = 30000;
|
||||
form = VIDEO_MODE_NTSC;
|
||||
break;
|
||||
case 6:
|
||||
if (pr)
|
||||
printk(" FRate: 50 fps");
|
||||
vi->framerate = 50000;
|
||||
form = VIDEO_MODE_PAL;
|
||||
break;
|
||||
case 7:
|
||||
if (pr)
|
||||
printk(" FRate: 60 fps");
|
||||
vi->framerate = 60000;
|
||||
form = VIDEO_MODE_NTSC;
|
||||
break;
|
||||
}
|
||||
|
||||
vi->bit_rate = (headr[4] << 10) | (headr[5] << 2) | (headr[6] & 0x03);
|
||||
|
||||
vi->vbv_buffer_size
|
||||
= (( headr[6] & 0xF8) >> 3 ) | (( headr[7] & 0x1F )<< 5);
|
||||
|
||||
if (pr){
|
||||
printk(" BRate: %d Mbit/s",4*(vi->bit_rate)/10000);
|
||||
printk(" vbvbuffer %d",16*1024*(vi->vbv_buffer_size));
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
vi->video_format = form;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
static int get_vinfo(u8 *mbuf, int count, struct dvb_video_info *vi, int pr)
|
||||
{
|
||||
u8 *headr;
|
||||
int found = 0;
|
||||
int c = 0;
|
||||
|
||||
while (found < 4 && c+4 < count){
|
||||
u8 *b;
|
||||
|
||||
b = mbuf+c;
|
||||
if ( b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01
|
||||
&& b[3] == 0xb3) found = 4;
|
||||
else {
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! found) return -1;
|
||||
c += 4;
|
||||
if (c+12 >= count) return -1;
|
||||
headr = mbuf+c;
|
||||
if (read_sequence_header(headr, vi, pr) < 0) return -1;
|
||||
vi->off = c-4;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
static int get_ainfo(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr)
|
||||
{
|
||||
u8 *headr;
|
||||
int found = 0;
|
||||
int c = 0;
|
||||
int fr = 0;
|
||||
|
||||
while (found < 2 && c < count){
|
||||
u8 b[2];
|
||||
memcpy( b, mbuf+c, 2);
|
||||
|
||||
if ( b[0] == 0xff && (b[1] & 0xf8) == 0xf8)
|
||||
found = 2;
|
||||
else {
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) return -1;
|
||||
|
||||
if (c+3 >= count) return -1;
|
||||
headr = mbuf+c;
|
||||
|
||||
ai->layer = (headr[1] & 0x06) >> 1;
|
||||
|
||||
if (pr)
|
||||
printk("Audiostream: Layer: %d", 4-ai->layer);
|
||||
|
||||
|
||||
ai->bit_rate = bitrates[(3-ai->layer)][(headr[2] >> 4 )]*1000;
|
||||
|
||||
if (pr){
|
||||
if (ai->bit_rate == 0)
|
||||
printk(" Bit rate: free");
|
||||
else if (ai->bit_rate == 0xf)
|
||||
printk(" BRate: reserved");
|
||||
else
|
||||
printk(" BRate: %d kb/s", ai->bit_rate/1000);
|
||||
}
|
||||
|
||||
fr = (headr[2] & 0x0c ) >> 2;
|
||||
ai->frequency = freq[fr]*100;
|
||||
if (pr){
|
||||
if (ai->frequency == 3)
|
||||
printk(" Freq: reserved\n");
|
||||
else
|
||||
printk(" Freq: %d kHz\n",ai->frequency);
|
||||
|
||||
}
|
||||
ai->off = c;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr)
|
||||
{
|
||||
u8 *headr;
|
||||
int found = 0;
|
||||
int c = 0;
|
||||
u8 frame = 0;
|
||||
int fr = 0;
|
||||
|
||||
while ( !found && c < count){
|
||||
u8 *b = mbuf+c;
|
||||
|
||||
if ( b[0] == 0x0b && b[1] == 0x77 )
|
||||
found = 1;
|
||||
else {
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) return -1;
|
||||
if (pr)
|
||||
printk("Audiostream: AC3");
|
||||
|
||||
ai->off = c;
|
||||
if (c+5 >= count) return -1;
|
||||
|
||||
ai->layer = 0; // 0 for AC3
|
||||
headr = mbuf+c+2;
|
||||
|
||||
frame = (headr[2]&0x3f);
|
||||
ai->bit_rate = ac3_bitrates[frame >> 1]*1000;
|
||||
|
||||
if (pr)
|
||||
printk(" BRate: %d kb/s", (int) ai->bit_rate/1000);
|
||||
|
||||
ai->frequency = (headr[2] & 0xc0 ) >> 6;
|
||||
fr = (headr[2] & 0xc0 ) >> 6;
|
||||
ai->frequency = freq[fr]*100;
|
||||
if (pr) printk (" Freq: %d Hz\n", (int) ai->frequency);
|
||||
|
||||
|
||||
ai->framesize = ac3_frames[fr][frame >> 1];
|
||||
if ((frame & 1) && (fr == 1)) ai->framesize++;
|
||||
ai->framesize = ai->framesize << 1;
|
||||
if (pr) printk (" Framesize %d\n",(int) ai->framesize);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_filter_get_ac3info);
|
||||
|
||||
|
||||
#if 0
|
||||
static u8 *skip_pes_header(u8 **bufp)
|
||||
{
|
||||
u8 *inbuf = *bufp;
|
||||
u8 *buf = inbuf;
|
||||
u8 *pts = NULL;
|
||||
int skip = 0;
|
||||
|
||||
static const int mpeg1_skip_table[16] = {
|
||||
1, 0xffff, 5, 10, 0xffff, 0xffff, 0xffff, 0xffff,
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
|
||||
};
|
||||
|
||||
|
||||
if ((inbuf[6] & 0xc0) == 0x80){ /* mpeg2 */
|
||||
if (buf[7] & PTS_ONLY)
|
||||
pts = buf+9;
|
||||
else pts = NULL;
|
||||
buf = inbuf + 9 + inbuf[8];
|
||||
} else { /* mpeg1 */
|
||||
for (buf = inbuf + 6; *buf == 0xff; buf++)
|
||||
if (buf == inbuf + 6 + 16) {
|
||||
break;
|
||||
}
|
||||
if ((*buf & 0xc0) == 0x40)
|
||||
buf += 2;
|
||||
skip = mpeg1_skip_table [*buf >> 4];
|
||||
if (skip == 5 || skip == 10) pts = buf;
|
||||
else pts = NULL;
|
||||
|
||||
buf += mpeg1_skip_table [*buf >> 4];
|
||||
}
|
||||
|
||||
*bufp = buf;
|
||||
return pts;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void initialize_quant_matrix( u32 *matrix )
|
||||
{
|
||||
int i;
|
||||
|
||||
matrix[0] = 0x08101013;
|
||||
matrix[1] = 0x10131616;
|
||||
matrix[2] = 0x16161616;
|
||||
matrix[3] = 0x1a181a1b;
|
||||
matrix[4] = 0x1b1b1a1a;
|
||||
matrix[5] = 0x1a1a1b1b;
|
||||
matrix[6] = 0x1b1d1d1d;
|
||||
matrix[7] = 0x2222221d;
|
||||
matrix[8] = 0x1d1d1b1b;
|
||||
matrix[9] = 0x1d1d2020;
|
||||
matrix[10] = 0x22222526;
|
||||
matrix[11] = 0x25232322;
|
||||
matrix[12] = 0x23262628;
|
||||
matrix[13] = 0x28283030;
|
||||
matrix[14] = 0x2e2e3838;
|
||||
matrix[15] = 0x3a454553;
|
||||
|
||||
for ( i = 16 ; i < 32 ; i++ )
|
||||
matrix[i] = 0x10101010;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void initialize_mpg_picture(struct mpg_picture *pic)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* set MPEG1 */
|
||||
pic->mpeg1_flag = 1;
|
||||
pic->profile_and_level = 0x4A ; /* MP@LL */
|
||||
pic->progressive_sequence = 1;
|
||||
pic->low_delay = 0;
|
||||
|
||||
pic->sequence_display_extension_flag = 0;
|
||||
for ( i = 0 ; i < 4 ; i++ ){
|
||||
pic->frame_centre_horizontal_offset[i] = 0;
|
||||
pic->frame_centre_vertical_offset[i] = 0;
|
||||
}
|
||||
pic->last_frame_centre_horizontal_offset = 0;
|
||||
pic->last_frame_centre_vertical_offset = 0;
|
||||
|
||||
pic->picture_display_extension_flag[0] = 0;
|
||||
pic->picture_display_extension_flag[1] = 0;
|
||||
pic->sequence_header_flag = 0;
|
||||
pic->gop_flag = 0;
|
||||
pic->sequence_end_flag = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void mpg_set_picture_parameter( int32_t field_type, struct mpg_picture *pic )
|
||||
{
|
||||
int16_t last_h_offset;
|
||||
int16_t last_v_offset;
|
||||
|
||||
int16_t *p_h_offset;
|
||||
int16_t *p_v_offset;
|
||||
|
||||
if ( pic->mpeg1_flag ){
|
||||
pic->picture_structure[field_type] = VIDEO_FRAME_PICTURE;
|
||||
pic->top_field_first = 0;
|
||||
pic->repeat_first_field = 0;
|
||||
pic->progressive_frame = 1;
|
||||
pic->picture_coding_parameter = 0x000010;
|
||||
}
|
||||
|
||||
/* Reset flag */
|
||||
pic->picture_display_extension_flag[field_type] = 0;
|
||||
|
||||
last_h_offset = pic->last_frame_centre_horizontal_offset;
|
||||
last_v_offset = pic->last_frame_centre_vertical_offset;
|
||||
if ( field_type == FIRST_FIELD ){
|
||||
p_h_offset = pic->frame_centre_horizontal_offset;
|
||||
p_v_offset = pic->frame_centre_vertical_offset;
|
||||
*p_h_offset = last_h_offset;
|
||||
*(p_h_offset + 1) = last_h_offset;
|
||||
*(p_h_offset + 2) = last_h_offset;
|
||||
*p_v_offset = last_v_offset;
|
||||
*(p_v_offset + 1) = last_v_offset;
|
||||
*(p_v_offset + 2) = last_v_offset;
|
||||
} else {
|
||||
pic->frame_centre_horizontal_offset[3] = last_h_offset;
|
||||
pic->frame_centre_vertical_offset[3] = last_v_offset;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
static void init_mpg_picture( struct mpg_picture *pic, int chan, int32_t field_type)
|
||||
{
|
||||
pic->picture_header = 0;
|
||||
pic->sequence_header_data
|
||||
= ( INIT_HORIZONTAL_SIZE << 20 )
|
||||
| ( INIT_VERTICAL_SIZE << 8 )
|
||||
| ( INIT_ASPECT_RATIO << 4 )
|
||||
| ( INIT_FRAME_RATE );
|
||||
pic->mpeg1_flag = 0;
|
||||
pic->vinfo.horizontal_size
|
||||
= INIT_DISP_HORIZONTAL_SIZE;
|
||||
pic->vinfo.vertical_size
|
||||
= INIT_DISP_VERTICAL_SIZE;
|
||||
pic->picture_display_extension_flag[field_type]
|
||||
= 0;
|
||||
pic->pts_flag[field_type] = 0;
|
||||
|
||||
pic->sequence_gop_header = 0;
|
||||
pic->picture_header = 0;
|
||||
pic->sequence_header_flag = 0;
|
||||
pic->gop_flag = 0;
|
||||
pic->sequence_end_flag = 0;
|
||||
pic->sequence_display_extension_flag = 0;
|
||||
pic->last_frame_centre_horizontal_offset = 0;
|
||||
pic->last_frame_centre_vertical_offset = 0;
|
||||
pic->channel = chan;
|
||||
}
|
||||
#endif
|
||||
|
||||
void dvb_filter_pes2ts_init(struct dvb_filter_pes2ts *p2ts, unsigned short pid,
|
||||
dvb_filter_pes2ts_cb_t *cb, void *priv)
|
||||
{
|
||||
unsigned char *buf=p2ts->buf;
|
||||
|
||||
buf[0]=0x47;
|
||||
buf[1]=(pid>>8);
|
||||
buf[2]=pid&0xff;
|
||||
p2ts->cc=0;
|
||||
p2ts->cb=cb;
|
||||
p2ts->priv=priv;
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_filter_pes2ts_init);
|
||||
|
||||
int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
|
||||
int len, int payload_start)
|
||||
{
|
||||
unsigned char *buf=p2ts->buf;
|
||||
int ret=0, rest;
|
||||
|
||||
//len=6+((pes[4]<<8)|pes[5]);
|
||||
|
||||
if (payload_start)
|
||||
buf[1]|=0x40;
|
||||
else
|
||||
buf[1]&=~0x40;
|
||||
while (len>=184) {
|
||||
buf[3]=0x10|((p2ts->cc++)&0x0f);
|
||||
memcpy(buf+4, pes, 184);
|
||||
if ((ret=p2ts->cb(p2ts->priv, buf)))
|
||||
return ret;
|
||||
len-=184; pes+=184;
|
||||
buf[1]&=~0x40;
|
||||
}
|
||||
if (!len)
|
||||
return 0;
|
||||
buf[3]=0x30|((p2ts->cc++)&0x0f);
|
||||
rest=183-len;
|
||||
if (rest) {
|
||||
buf[5]=0x00;
|
||||
if (rest-1)
|
||||
memset(buf+6, 0xff, rest-1);
|
||||
}
|
||||
buf[4]=rest;
|
||||
memcpy(buf+5+rest, pes, len);
|
||||
return p2ts->cb(p2ts->priv, buf);
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_filter_pes2ts);
|
@@ -28,6 +28,8 @@
|
||||
/* Enables DVBv3 compatibility bits at the headers */
|
||||
#define __DVB_CORE__
|
||||
|
||||
#define pr_fmt(fmt) "dvb_frontend: " fmt
|
||||
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
@@ -67,6 +69,9 @@ MODULE_PARM_DESC(dvb_powerdown_on_sleep, "0: do not power down, 1: turn LNB volt
|
||||
module_param(dvb_mfe_wait_time, int, 0644);
|
||||
MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to <mfe_wait_time> seconds on open() for multi-frontend to become available (default:5 seconds)");
|
||||
|
||||
#define dprintk(fmt, arg...) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg)
|
||||
|
||||
#define FESTATE_IDLE 1
|
||||
#define FESTATE_RETUNE 2
|
||||
#define FESTATE_TUNING_FAST 4
|
||||
@@ -99,8 +104,6 @@ MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to <mfe_wait_time> seconds on open(
|
||||
static DEFINE_MUTEX(frontend_mutex);
|
||||
|
||||
struct dvb_frontend_private {
|
||||
struct kref refcount;
|
||||
|
||||
/* thread/frontend values */
|
||||
struct dvb_device *dvbdev;
|
||||
struct dvb_frontend_parameters parameters_out;
|
||||
@@ -138,21 +141,30 @@ struct dvb_frontend_private {
|
||||
#endif
|
||||
};
|
||||
|
||||
static void dvb_frontend_private_free(struct kref *ref)
|
||||
static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
|
||||
void (*release)(struct dvb_frontend *fe));
|
||||
|
||||
static void dvb_frontend_free(struct kref *ref)
|
||||
{
|
||||
struct dvb_frontend_private *fepriv =
|
||||
container_of(ref, struct dvb_frontend_private, refcount);
|
||||
struct dvb_frontend *fe =
|
||||
container_of(ref, struct dvb_frontend, refcount);
|
||||
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
||||
|
||||
dvb_free_device(fepriv->dvbdev);
|
||||
|
||||
dvb_frontend_invoke_release(fe, fe->ops.release);
|
||||
|
||||
kfree(fepriv);
|
||||
}
|
||||
|
||||
static void dvb_frontend_private_put(struct dvb_frontend_private *fepriv)
|
||||
static void dvb_frontend_put(struct dvb_frontend *fe)
|
||||
{
|
||||
kref_put(&fepriv->refcount, dvb_frontend_private_free);
|
||||
kref_put(&fe->refcount, dvb_frontend_free);
|
||||
}
|
||||
|
||||
static void dvb_frontend_private_get(struct dvb_frontend_private *fepriv)
|
||||
static void dvb_frontend_get(struct dvb_frontend *fe)
|
||||
{
|
||||
kref_get(&fepriv->refcount);
|
||||
kref_get(&fe->refcount);
|
||||
}
|
||||
|
||||
static void dvb_frontend_wakeup(struct dvb_frontend *fe);
|
||||
@@ -1515,12 +1527,8 @@ static int dtv_set_frontend(struct dvb_frontend *fe);
|
||||
|
||||
static bool is_dvbv3_delsys(u32 delsys)
|
||||
{
|
||||
bool status;
|
||||
|
||||
status = (delsys == SYS_DVBT) || (delsys == SYS_DVBC_ANNEX_A) ||
|
||||
(delsys == SYS_DVBS) || (delsys == SYS_ATSC);
|
||||
|
||||
return status;
|
||||
return (delsys == SYS_DVBT) || (delsys == SYS_DVBC_ANNEX_A) ||
|
||||
(delsys == SYS_DVBS) || (delsys == SYS_ATSC);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2356,7 +2364,8 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
||||
int i;
|
||||
u8 last = 1;
|
||||
if (dvb_frontend_debug)
|
||||
printk("%s switch command: 0x%04lx\n", __func__, swcmd);
|
||||
dprintk("%s switch command: 0x%04lx\n",
|
||||
__func__, swcmd);
|
||||
nexttime = ktime_get_boottime();
|
||||
if (dvb_frontend_debug)
|
||||
tv[0] = nexttime;
|
||||
@@ -2379,10 +2388,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
|
||||
dvb_frontend_sleep_until(&nexttime, 8000);
|
||||
}
|
||||
if (dvb_frontend_debug) {
|
||||
printk("%s(%d): switch delay (should be 32k followed by all 8k\n",
|
||||
dprintk("%s(%d): switch delay (should be 32k followed by all 8k)\n",
|
||||
__func__, fe->dvb->num);
|
||||
for (i = 1; i < 10; i++)
|
||||
printk("%d: %d\n", i,
|
||||
pr_info("%d: %d\n", i,
|
||||
(int) ktime_us_delta(tv[i], tv[i-1]));
|
||||
}
|
||||
err = 0;
|
||||
@@ -2545,7 +2554,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
|
||||
fepriv->events.eventr = fepriv->events.eventw = 0;
|
||||
}
|
||||
|
||||
dvb_frontend_private_get(fepriv);
|
||||
dvb_frontend_get(fe);
|
||||
|
||||
if (adapter->mfe_shared)
|
||||
mutex_unlock (&adapter->mfe_lock);
|
||||
@@ -2595,7 +2604,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
|
||||
fe->ops.ts_bus_ctrl(fe, 0);
|
||||
}
|
||||
|
||||
dvb_frontend_private_put(fepriv);
|
||||
dvb_frontend_put(fe);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -2685,7 +2694,14 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
|
||||
}
|
||||
fepriv = fe->frontend_priv;
|
||||
|
||||
kref_init(&fepriv->refcount);
|
||||
kref_init(&fe->refcount);
|
||||
|
||||
/*
|
||||
* After initialization, there need to be two references: one
|
||||
* for dvb_unregister_frontend(), and another one for
|
||||
* dvb_frontend_detach().
|
||||
*/
|
||||
dvb_frontend_get(fe);
|
||||
|
||||
sema_init(&fepriv->sem, 1);
|
||||
init_waitqueue_head (&fepriv->wait_queue);
|
||||
@@ -2720,50 +2736,33 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
|
||||
dev_dbg(fe->dvb->device, "%s:\n", __func__);
|
||||
|
||||
mutex_lock(&frontend_mutex);
|
||||
dvb_frontend_stop (fe);
|
||||
dvb_unregister_device (fepriv->dvbdev);
|
||||
dvb_frontend_stop(fe);
|
||||
dvb_remove_device(fepriv->dvbdev);
|
||||
|
||||
/* fe is invalid now */
|
||||
mutex_unlock(&frontend_mutex);
|
||||
dvb_frontend_private_put(fepriv);
|
||||
dvb_frontend_put(fe);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_unregister_frontend);
|
||||
|
||||
static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
|
||||
void (*release)(struct dvb_frontend *fe))
|
||||
{
|
||||
if (release) {
|
||||
release(fe);
|
||||
#ifdef CONFIG_MEDIA_ATTACH
|
||||
void dvb_frontend_detach(struct dvb_frontend* fe)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if (fe->ops.release_sec) {
|
||||
fe->ops.release_sec(fe);
|
||||
dvb_detach(fe->ops.release_sec);
|
||||
}
|
||||
if (fe->ops.tuner_ops.release) {
|
||||
fe->ops.tuner_ops.release(fe);
|
||||
dvb_detach(fe->ops.tuner_ops.release);
|
||||
}
|
||||
if (fe->ops.analog_ops.release) {
|
||||
fe->ops.analog_ops.release(fe);
|
||||
dvb_detach(fe->ops.analog_ops.release);
|
||||
}
|
||||
ptr = (void*)fe->ops.release;
|
||||
if (ptr) {
|
||||
fe->ops.release(fe);
|
||||
dvb_detach(ptr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void dvb_frontend_detach(struct dvb_frontend* fe)
|
||||
{
|
||||
if (fe->ops.release_sec)
|
||||
fe->ops.release_sec(fe);
|
||||
if (fe->ops.tuner_ops.release)
|
||||
fe->ops.tuner_ops.release(fe);
|
||||
if (fe->ops.analog_ops.release)
|
||||
fe->ops.analog_ops.release(fe);
|
||||
if (fe->ops.release)
|
||||
fe->ops.release(fe);
|
||||
}
|
||||
dvb_detach(release);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void dvb_frontend_detach(struct dvb_frontend* fe)
|
||||
{
|
||||
dvb_frontend_invoke_release(fe, fe->ops.release_sec);
|
||||
dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release);
|
||||
dvb_frontend_invoke_release(fe, fe->ops.analog_ops.release);
|
||||
dvb_frontend_invoke_release(fe, fe->ops.detach);
|
||||
dvb_frontend_put(fe);
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_frontend_detach);
|
||||
|
@@ -225,7 +225,7 @@ struct dvb_tuner_ops {
|
||||
|
||||
struct dvb_tuner_info info;
|
||||
|
||||
int (*release)(struct dvb_frontend *fe);
|
||||
void (*release)(struct dvb_frontend *fe);
|
||||
int (*init)(struct dvb_frontend *fe);
|
||||
int (*sleep)(struct dvb_frontend *fe);
|
||||
int (*suspend)(struct dvb_frontend *fe);
|
||||
@@ -323,7 +323,11 @@ struct dtv_frontend_properties;
|
||||
*
|
||||
* @info: embedded struct dvb_tuner_info with tuner properties
|
||||
* @delsys: Delivery systems supported by the frontend
|
||||
* @release: callback function called when frontend is dettached.
|
||||
* @detach: callback function called when frontend is detached.
|
||||
* drivers should clean up, but not yet free the struct
|
||||
* dvb_frontend allocation.
|
||||
* @release: callback function called when frontend is ready to be
|
||||
* freed.
|
||||
* drivers should free any allocated memory.
|
||||
* @release_sec: callback function requesting that the Satelite Equipment
|
||||
* Control (SEC) driver to release and free any memory
|
||||
@@ -408,6 +412,7 @@ struct dvb_frontend_ops {
|
||||
|
||||
u8 delsys[MAX_DELSYS];
|
||||
|
||||
void (*detach)(struct dvb_frontend *fe);
|
||||
void (*release)(struct dvb_frontend* fe);
|
||||
void (*release_sec)(struct dvb_frontend* fe);
|
||||
|
||||
@@ -655,6 +660,7 @@ struct dtv_frontend_properties {
|
||||
*/
|
||||
|
||||
struct dvb_frontend {
|
||||
struct kref refcount;
|
||||
struct dvb_frontend_ops ops;
|
||||
struct dvb_adapter *dvb;
|
||||
void *demodulator_priv;
|
||||
|
文件差异内容过多而无法显示
加载差异
@@ -21,6 +21,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "dvbdev: " fmt
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/string.h>
|
||||
@@ -43,7 +45,11 @@ static int dvbdev_debug;
|
||||
module_param(dvbdev_debug, int, 0644);
|
||||
MODULE_PARM_DESC(dvbdev_debug, "Turn on/off device debugging (default:off).");
|
||||
|
||||
#define dprintk if (dvbdev_debug) printk
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (dvbdev_debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
static LIST_HEAD(dvb_adapter_list);
|
||||
static DEFINE_MUTEX(dvbdev_register_lock);
|
||||
@@ -354,7 +360,7 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
printk(KERN_DEBUG "%s: media entity '%s' registered.\n",
|
||||
pr_info("%s: media entity '%s' registered.\n",
|
||||
__func__, dvbdev->entity->name);
|
||||
|
||||
return 0;
|
||||
@@ -438,7 +444,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
|
||||
if ((id = dvbdev_get_free_id (adap, type)) < 0){
|
||||
mutex_unlock(&dvbdev_register_lock);
|
||||
*pdvbdev = NULL;
|
||||
printk(KERN_ERR "%s: couldn't find free device id\n", __func__);
|
||||
pr_err("%s: couldn't find free device id\n", __func__);
|
||||
return -ENFILE;
|
||||
}
|
||||
|
||||
@@ -493,8 +499,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
|
||||
|
||||
ret = dvb_register_media_device(dvbdev, type, minor, demux_sink_pads);
|
||||
if (ret) {
|
||||
printk(KERN_ERR
|
||||
"%s: dvb_register_media_device failed to create the mediagraph\n",
|
||||
pr_err("%s: dvb_register_media_device failed to create the mediagraph\n",
|
||||
__func__);
|
||||
|
||||
dvb_media_device_free(dvbdev);
|
||||
@@ -511,11 +516,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
|
||||
MKDEV(DVB_MAJOR, minor),
|
||||
dvbdev, "dvb%d.%s%d", adap->num, dnames[type], id);
|
||||
if (IS_ERR(clsdev)) {
|
||||
printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n",
|
||||
pr_err("%s: failed to create device dvb%d.%s%d (%ld)\n",
|
||||
__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",
|
||||
dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
|
||||
adap->num, dnames[type], id, minor, minor);
|
||||
|
||||
return 0;
|
||||
@@ -523,7 +528,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
|
||||
EXPORT_SYMBOL(dvb_register_device);
|
||||
|
||||
|
||||
void dvb_unregister_device(struct dvb_device *dvbdev)
|
||||
void dvb_remove_device(struct dvb_device *dvbdev)
|
||||
{
|
||||
if (!dvbdev)
|
||||
return;
|
||||
@@ -537,9 +542,26 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
|
||||
device_destroy(dvb_class, MKDEV(DVB_MAJOR, dvbdev->minor));
|
||||
|
||||
list_del (&dvbdev->list_head);
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_remove_device);
|
||||
|
||||
|
||||
void dvb_free_device(struct dvb_device *dvbdev)
|
||||
{
|
||||
if (!dvbdev)
|
||||
return;
|
||||
|
||||
kfree (dvbdev->fops);
|
||||
kfree (dvbdev);
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_free_device);
|
||||
|
||||
|
||||
void dvb_unregister_device(struct dvb_device *dvbdev)
|
||||
{
|
||||
dvb_remove_device(dvbdev);
|
||||
dvb_free_device(dvbdev);
|
||||
}
|
||||
EXPORT_SYMBOL(dvb_unregister_device);
|
||||
|
||||
|
||||
@@ -808,7 +830,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
|
||||
memset (adap, 0, sizeof(struct dvb_adapter));
|
||||
INIT_LIST_HEAD (&adap->device_list);
|
||||
|
||||
printk(KERN_INFO "DVB: registering new adapter (%s)\n", name);
|
||||
pr_info("DVB: registering new adapter (%s)\n", name);
|
||||
|
||||
adap->num = num;
|
||||
adap->name = name;
|
||||
@@ -926,13 +948,13 @@ static int __init init_dvbdev(void)
|
||||
dev_t dev = MKDEV(DVB_MAJOR, 0);
|
||||
|
||||
if ((retval = register_chrdev_region(dev, MAX_DVB_MINORS, "DVB")) != 0) {
|
||||
printk(KERN_ERR "dvb-core: unable to get major %d\n", DVB_MAJOR);
|
||||
pr_err("dvb-core: unable to get major %d\n", DVB_MAJOR);
|
||||
return retval;
|
||||
}
|
||||
|
||||
cdev_init(&dvb_device_cdev, &dvb_device_fops);
|
||||
if ((retval = cdev_add(&dvb_device_cdev, dev, MAX_DVB_MINORS)) != 0) {
|
||||
printk(KERN_ERR "dvb-core: unable register character device\n");
|
||||
pr_err("dvb-core: unable register character device\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0
|
||||
#define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS
|
||||
#else
|
||||
#define DVB_MAX_ADAPTERS 8
|
||||
#define DVB_MAX_ADAPTERS 16
|
||||
#endif
|
||||
|
||||
#define DVB_UNSET (-1)
|
||||
@@ -211,9 +211,32 @@ int dvb_register_device(struct dvb_adapter *adap,
|
||||
int type,
|
||||
int demux_sink_pads);
|
||||
|
||||
/**
|
||||
* dvb_remove_device - Remove a registered DVB device
|
||||
*
|
||||
* This does not free memory. To do that, call dvb_free_device().
|
||||
*
|
||||
* @dvbdev: pointer to struct dvb_device
|
||||
*/
|
||||
void dvb_remove_device(struct dvb_device *dvbdev);
|
||||
|
||||
/**
|
||||
* dvb_free_device - Free memory occupied by a DVB device.
|
||||
*
|
||||
* Call dvb_unregister_device() before calling this function.
|
||||
*
|
||||
* @dvbdev: pointer to struct dvb_device
|
||||
*/
|
||||
void dvb_free_device(struct dvb_device *dvbdev);
|
||||
|
||||
/**
|
||||
* dvb_unregister_device - Unregisters a DVB device
|
||||
*
|
||||
* This is a combination of dvb_remove_device() and dvb_free_device().
|
||||
* Using this function is usually a mistake, and is often an indicator
|
||||
* for a use-after-free bug (when a userspace process keeps a file
|
||||
* handle to a detached device).
|
||||
*
|
||||
* @dvbdev: pointer to struct dvb_device
|
||||
*/
|
||||
void dvb_unregister_device(struct dvb_device *dvbdev);
|
||||
|
@@ -642,7 +642,7 @@ config DVB_S5H1409
|
||||
to support this frontend.
|
||||
|
||||
config DVB_AU8522
|
||||
depends on I2C
|
||||
depends on DVB_CORE && I2C
|
||||
tristate
|
||||
|
||||
config DVB_AU8522_DTV
|
||||
@@ -656,7 +656,7 @@ config DVB_AU8522_DTV
|
||||
|
||||
config DVB_AU8522_V4L
|
||||
tristate "Auvitek AU8522 based ATV demod"
|
||||
depends on VIDEO_V4L2 && I2C
|
||||
depends on VIDEO_V4L2 && DVB_CORE && I2C
|
||||
select DVB_AU8522
|
||||
default m if !MEDIA_SUBDRV_AUTOSELECT
|
||||
help
|
||||
@@ -722,7 +722,7 @@ config DVB_PLL
|
||||
|
||||
config DVB_TUNER_DIB0070
|
||||
tristate "DiBcom DiB0070 silicon base-band tuner"
|
||||
depends on I2C
|
||||
depends on DVB_CORE && I2C
|
||||
default m if !MEDIA_SUBDRV_AUTOSELECT
|
||||
help
|
||||
A driver for the silicon baseband tuner DiB0070 from DiBcom.
|
||||
@@ -731,7 +731,7 @@ config DVB_TUNER_DIB0070
|
||||
|
||||
config DVB_TUNER_DIB0090
|
||||
tristate "DiBcom DiB0090 silicon base-band tuner"
|
||||
depends on I2C
|
||||
depends on DVB_CORE && I2C
|
||||
default m if !MEDIA_SUBDRV_AUTOSELECT
|
||||
help
|
||||
A driver for the silicon baseband tuner DiB0090 from DiBcom.
|
||||
@@ -879,5 +879,6 @@ comment "Tools to develop new frontends"
|
||||
|
||||
config DVB_DUMMY_FE
|
||||
tristate "Dummy frontend driver"
|
||||
depends on DVB_CORE
|
||||
default n
|
||||
endmenu
|
||||
|
@@ -1351,7 +1351,7 @@ static void af9013_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops af9013_ops;
|
||||
static const struct dvb_frontend_ops af9013_ops;
|
||||
|
||||
static int af9013_download_firmware(struct af9013_state *state)
|
||||
{
|
||||
@@ -1516,7 +1516,7 @@ err:
|
||||
}
|
||||
EXPORT_SYMBOL(af9013_attach);
|
||||
|
||||
static struct dvb_frontend_ops af9013_ops = {
|
||||
static const struct dvb_frontend_ops af9013_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Afatech AF9013",
|
||||
|
@@ -1198,7 +1198,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops af9033_ops = {
|
||||
static const struct dvb_frontend_ops af9033_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Afatech AF9033 (DVB-T)",
|
||||
|
@@ -415,7 +415,7 @@ static void as102_fe_release(struct dvb_frontend *fe)
|
||||
}
|
||||
|
||||
|
||||
static struct dvb_frontend_ops as102_fe_ops = {
|
||||
static const struct dvb_frontend_ops as102_fe_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Abilis AS102 DVB-T",
|
||||
|
@@ -254,14 +254,13 @@ static int ascot2e_init(struct dvb_frontend *fe)
|
||||
return ascot2e_leave_power_save(priv);
|
||||
}
|
||||
|
||||
static int ascot2e_release(struct dvb_frontend *fe)
|
||||
static void ascot2e_release(struct dvb_frontend *fe)
|
||||
{
|
||||
struct ascot2e_priv *priv = fe->tuner_priv;
|
||||
|
||||
dev_dbg(&priv->i2c->dev, "%s()\n", __func__);
|
||||
kfree(fe->tuner_priv);
|
||||
fe->tuner_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ascot2e_sleep(struct dvb_frontend *fe)
|
||||
|
@@ -428,7 +428,7 @@ static int atbm8830_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
|
||||
return atbm8830_write_reg(priv, REG_I2C_GATE, enable ? 1 : 0);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops atbm8830_ops = {
|
||||
static const struct dvb_frontend_ops atbm8830_ops = {
|
||||
.delsys = { SYS_DTMB },
|
||||
.info = {
|
||||
.name = "AltoBeam ATBM8830/8831 DMB-TH",
|
||||
|
@@ -50,8 +50,8 @@ int au8522_writereg(struct au8522_state *state, u16 reg, u8 data)
|
||||
ret = i2c_transfer(state->i2c, &msg, 1);
|
||||
|
||||
if (ret != 1)
|
||||
printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, "
|
||||
"ret == %i)\n", __func__, reg, data, ret);
|
||||
printk("%s: writereg error (reg == 0x%02x, val == 0x%04x, ret == %i)\n",
|
||||
__func__, reg, data, ret);
|
||||
|
||||
return (ret != 1) ? -1 : 0;
|
||||
}
|
||||
|
@@ -834,7 +834,7 @@ static int au8522_get_tune_settings(struct dvb_frontend *fe,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops au8522_ops;
|
||||
static const struct dvb_frontend_ops au8522_ops;
|
||||
|
||||
|
||||
static void au8522_release(struct dvb_frontend *fe)
|
||||
@@ -894,7 +894,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(au8522_attach);
|
||||
|
||||
static struct dvb_frontend_ops au8522_ops = {
|
||||
static const struct dvb_frontend_ops au8522_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Auvitek AU8522 QAM/8VSB Frontend",
|
||||
|
@@ -788,7 +788,7 @@ static int bcm3510_init(struct dvb_frontend* fe)
|
||||
}
|
||||
|
||||
|
||||
static struct dvb_frontend_ops bcm3510_ops;
|
||||
static const struct dvb_frontend_ops bcm3510_ops;
|
||||
|
||||
struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -834,7 +834,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(bcm3510_attach);
|
||||
|
||||
static struct dvb_frontend_ops bcm3510_ops = {
|
||||
static const struct dvb_frontend_ops bcm3510_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Broadcom BCM3510 VSB/QAM frontend",
|
||||
|
@@ -380,7 +380,7 @@ static void cx22700_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx22700_ops;
|
||||
static const struct dvb_frontend_ops cx22700_ops;
|
||||
|
||||
struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -408,7 +408,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx22700_ops = {
|
||||
static const struct dvb_frontend_ops cx22700_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Conexant CX22700 DVB-T",
|
||||
|
@@ -120,8 +120,8 @@ static int cx24110_writereg (struct cx24110_state* state, int reg, int data)
|
||||
int err;
|
||||
|
||||
if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
|
||||
dprintk ("%s: writereg error (err == %i, reg == 0x%02x,"
|
||||
" data == 0x%02x)\n", __func__, err, reg, data);
|
||||
dprintk("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n",
|
||||
__func__, err, reg, data);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ static void cx24110_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24110_ops;
|
||||
static const struct dvb_frontend_ops cx24110_ops;
|
||||
|
||||
struct dvb_frontend* cx24110_attach(const struct cx24110_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -625,7 +625,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24110_ops = {
|
||||
static const struct dvb_frontend_ops cx24110_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "Conexant CX24110 DVB-S",
|
||||
|
@@ -108,8 +108,8 @@ static int cx24113_writereg(struct cx24113_state *state, int reg, int data)
|
||||
.flags = 0, .buf = buf, .len = 2 };
|
||||
int err = i2c_transfer(state->i2c, &msg, 1);
|
||||
if (err != 1) {
|
||||
printk(KERN_DEBUG "%s: writereg error(err == %i, reg == 0x%02x,"
|
||||
" data == 0x%02x)\n", __func__, err, reg, data);
|
||||
printk(KERN_DEBUG "%s: writereg error(err == %i, reg == 0x%02x, data == 0x%02x)\n",
|
||||
__func__, err, reg, data);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -527,13 +527,12 @@ static int cx24113_get_frequency(struct dvb_frontend *fe, u32 *frequency)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cx24113_release(struct dvb_frontend *fe)
|
||||
static void cx24113_release(struct dvb_frontend *fe)
|
||||
{
|
||||
struct cx24113_state *state = fe->tuner_priv;
|
||||
dprintk("\n");
|
||||
fe->tuner_priv = NULL;
|
||||
kfree(state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dvb_tuner_ops cx24113_tuner_ops = {
|
||||
|
@@ -209,8 +209,8 @@ static int cx24116_writereg(struct cx24116_state *state, int reg, int data)
|
||||
|
||||
err = i2c_transfer(state->i2c, &msg, 1);
|
||||
if (err != 1) {
|
||||
printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x,"
|
||||
" value == 0x%02x)\n", __func__, err, reg, data);
|
||||
printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x, value == 0x%02x)\n",
|
||||
__func__, err, reg, data);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
@@ -498,8 +498,8 @@ static int cx24116_firmware_ondemand(struct dvb_frontend *fe)
|
||||
printk(KERN_INFO "%s: Waiting for firmware upload(2)...\n",
|
||||
__func__);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "%s: No firmware uploaded "
|
||||
"(timeout or file not found?)\n", __func__);
|
||||
printk(KERN_ERR "%s: No firmware uploaded (timeout or file not found?)\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1116,7 +1116,7 @@ static void cx24116_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24116_ops;
|
||||
static const struct dvb_frontend_ops cx24116_ops;
|
||||
|
||||
struct dvb_frontend *cx24116_attach(const struct cx24116_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -1467,7 +1467,7 @@ static int cx24116_get_algo(struct dvb_frontend *fe)
|
||||
return DVBFE_ALGO_HW;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24116_ops = {
|
||||
static const struct dvb_frontend_ops cx24116_ops = {
|
||||
.delsys = { SYS_DVBS, SYS_DVBS2 },
|
||||
.info = {
|
||||
.name = "Conexant CX24116/CX24118",
|
||||
|
@@ -474,8 +474,8 @@ static int cx24117_firmware_ondemand(struct dvb_frontend *fe)
|
||||
"%s: Waiting for firmware upload(2)...\n", __func__);
|
||||
if (ret) {
|
||||
dev_err(&state->priv->i2c->dev,
|
||||
"%s: No firmware uploaded "
|
||||
"(timeout or file not found?)\n", __func__);
|
||||
"%s: No firmware uploaded (timeout or file not found?)\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1164,7 +1164,7 @@ static void cx24117_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24117_ops;
|
||||
static const struct dvb_frontend_ops cx24117_ops;
|
||||
|
||||
struct dvb_frontend *cx24117_attach(const struct cx24117_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -1618,7 +1618,7 @@ static int cx24117_get_frontend(struct dvb_frontend *fe,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24117_ops = {
|
||||
static const struct dvb_frontend_ops cx24117_ops = {
|
||||
.delsys = { SYS_DVBS, SYS_DVBS2 },
|
||||
.info = {
|
||||
.name = "Conexant CX24117/CX24132",
|
||||
|
@@ -267,7 +267,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24120_ops;
|
||||
static const struct dvb_frontend_ops cx24120_ops;
|
||||
|
||||
struct dvb_frontend *cx24120_attach(const struct cx24120_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -1154,8 +1154,7 @@ static int cx24120_set_frontend(struct dvb_frontend *fe)
|
||||
dev_dbg(&state->i2c->dev,
|
||||
"delivery system(%d) not supported\n",
|
||||
c->delivery_system);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
state->dnxt.delsys = c->delivery_system;
|
||||
@@ -1552,7 +1551,7 @@ static int cx24120_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cx24120_ops = {
|
||||
static const struct dvb_frontend_ops cx24120_ops = {
|
||||
.delsys = { SYS_DVBS, SYS_DVBS2 },
|
||||
.info = {
|
||||
.name = "Conexant CX24120/CX24118",
|
||||
|
@@ -255,8 +255,8 @@ static int cx24123_i2c_writereg(struct cx24123_state *state,
|
||||
|
||||
err = i2c_transfer(state->i2c, &msg, 1);
|
||||
if (err != 1) {
|
||||
printk("%s: writereg error(err == %i, reg == 0x%02x,"
|
||||
" data == 0x%02x)\n", __func__, err, reg, data);
|
||||
printk("%s: writereg error(err == %i, reg == 0x%02x, data == 0x%02x)\n",
|
||||
__func__, err, reg, data);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1049,7 +1049,7 @@ struct i2c_adapter *
|
||||
}
|
||||
EXPORT_SYMBOL(cx24123_get_tuner_i2c_adapter);
|
||||
|
||||
static struct dvb_frontend_ops cx24123_ops;
|
||||
static const struct dvb_frontend_ops cx24123_ops;
|
||||
|
||||
struct dvb_frontend *cx24123_attach(const struct cx24123_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -1111,7 +1111,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(cx24123_attach);
|
||||
|
||||
static struct dvb_frontend_ops cx24123_ops = {
|
||||
static const struct dvb_frontend_ops cx24123_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "Conexant CX24123/CX24109",
|
||||
|
@@ -3719,7 +3719,7 @@ static int cxd2841er_init_tc(struct dvb_frontend *fe)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops;
|
||||
static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops;
|
||||
static struct dvb_frontend_ops cxd2841er_t_c_ops;
|
||||
|
||||
static struct dvb_frontend *cxd2841er_attach(struct cxd2841er_config *cfg,
|
||||
@@ -3801,7 +3801,7 @@ struct dvb_frontend *cxd2841er_attach_t_c(struct cxd2841er_config *cfg,
|
||||
}
|
||||
EXPORT_SYMBOL(cxd2841er_attach_t_c);
|
||||
|
||||
static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = {
|
||||
static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = {
|
||||
.delsys = { SYS_DVBS, SYS_DVBS2 },
|
||||
.info = {
|
||||
.name = "Sony CXD2841ER DVB-S/S2 demodulator",
|
||||
@@ -3829,7 +3829,7 @@ static struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = {
|
||||
.tune = cxd2841er_tune_s
|
||||
};
|
||||
|
||||
static struct dvb_frontend_ops cxd2841er_t_c_ops = {
|
||||
static struct dvb_frontend_ops cxd2841er_t_c_ops = {
|
||||
.delsys = { SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A },
|
||||
.info = {
|
||||
.name = "", /* will set in attach function */
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -38,12 +40,10 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { \
|
||||
if (debug) { \
|
||||
printk(KERN_DEBUG "DiB0070: "); \
|
||||
printk(args); \
|
||||
printk("\n"); \
|
||||
} \
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
#define DIB0070_P1D 0x00
|
||||
@@ -87,7 +87,7 @@ static u16 dib0070_read_reg(struct dib0070_state *state, u8 reg)
|
||||
u16 ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ static u16 dib0070_read_reg(struct dib0070_state *state, u8 reg)
|
||||
state->msg[1].len = 2;
|
||||
|
||||
if (i2c_transfer(state->i2c, state->msg, 2) != 2) {
|
||||
printk(KERN_WARNING "DiB0070 I2C read failed\n");
|
||||
pr_warn("DiB0070 I2C read failed\n");
|
||||
ret = 0;
|
||||
} else
|
||||
ret = (state->i2c_read_buffer[0] << 8)
|
||||
@@ -119,7 +119,7 @@ static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val)
|
||||
int ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
state->i2c_write_buffer[0] = reg;
|
||||
@@ -133,7 +133,7 @@ static int dib0070_write_reg(struct dib0070_state *state, u8 reg, u16 val)
|
||||
state->msg[0].len = 3;
|
||||
|
||||
if (i2c_transfer(state->i2c, state->msg, 1) != 1) {
|
||||
printk(KERN_WARNING "DiB0070 I2C write failed\n");
|
||||
pr_warn("DiB0070 I2C write failed\n");
|
||||
ret = -EREMOTEIO;
|
||||
} else
|
||||
ret = 0;
|
||||
@@ -205,7 +205,7 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state
|
||||
|
||||
adc = dib0070_read_reg(state, 0x19);
|
||||
|
||||
dprintk("CAPTRIM=%hd; ADC = %hd (ADC) & %dmV", state->captrim, adc, (u32) adc*(u32)1800/(u32)1024);
|
||||
dprintk("CAPTRIM=%hd; ADC = %hd (ADC) & %dmV\n", state->captrim, adc, (u32) adc*(u32)1800/(u32)1024);
|
||||
|
||||
if (adc >= 400) {
|
||||
adc -= 400;
|
||||
@@ -216,7 +216,7 @@ static int dib0070_captrim(struct dib0070_state *state, enum frontend_tune_state
|
||||
}
|
||||
|
||||
if (adc < state->adc_diff) {
|
||||
dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)", state->captrim, adc, state->adc_diff);
|
||||
dprintk("CAPTRIM=%hd is closer to target (%hd/%hd)\n", state->captrim, adc, state->adc_diff);
|
||||
state->adc_diff = adc;
|
||||
state->fcaptrim = state->captrim;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ static int dib0070_set_ctrl_lo5(struct dvb_frontend *fe, u8 vco_bias_trim, u8 hf
|
||||
struct dib0070_state *state = fe->tuner_priv;
|
||||
u16 lo5 = (third_order_filt << 14) | (0 << 13) | (1 << 12) | (3 << 9) | (cp_current << 6) | (hf_div_trim << 3) | (vco_bias_trim << 0);
|
||||
|
||||
dprintk("CTRL_LO5: 0x%x", lo5);
|
||||
dprintk("CTRL_LO5: 0x%x\n", lo5);
|
||||
return dib0070_write_reg(state, 0x15, lo5);
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ void dib0070_ctrl_agc_filter(struct dvb_frontend *fe, u8 open)
|
||||
dib0070_write_reg(state, 0x1b, 0x4112);
|
||||
if (state->cfg->vga_filter != 0) {
|
||||
dib0070_write_reg(state, 0x1a, state->cfg->vga_filter);
|
||||
dprintk("vga filter register is set to %x", state->cfg->vga_filter);
|
||||
dprintk("vga filter register is set to %x\n", state->cfg->vga_filter);
|
||||
} else
|
||||
dib0070_write_reg(state, 0x1a, 0x0009);
|
||||
}
|
||||
@@ -380,7 +380,7 @@ static int dib0070_tune_digital(struct dvb_frontend *fe)
|
||||
}
|
||||
|
||||
if (*tune_state == CT_TUNER_START) {
|
||||
dprintk("Tuning for Band: %hd (%d kHz)", band, freq);
|
||||
dprintk("Tuning for Band: %hd (%d kHz)\n", band, freq);
|
||||
if (state->current_rf != freq) {
|
||||
u8 REFDIV;
|
||||
u32 FBDiv, Rest, FREF, VCOF_kHz;
|
||||
@@ -458,12 +458,12 @@ static int dib0070_tune_digital(struct dvb_frontend *fe)
|
||||
dib0070_write_reg(state, 0x20,
|
||||
0x0040 | 0x0020 | 0x0010 | 0x0008 | 0x0002 | 0x0001 | state->current_tune_table_index->tuner_enable);
|
||||
|
||||
dprintk("REFDIV: %hd, FREF: %d", REFDIV, FREF);
|
||||
dprintk("FBDIV: %d, Rest: %d", FBDiv, Rest);
|
||||
dprintk("Num: %hd, Den: %hd, SD: %hd", (u16) Rest, Den, (state->lo4 >> 12) & 0x1);
|
||||
dprintk("HFDIV code: %hd", state->current_tune_table_index->hfdiv);
|
||||
dprintk("VCO = %hd", state->current_tune_table_index->vco_band);
|
||||
dprintk("VCOF: ((%hd*%d) << 1))", state->current_tune_table_index->vco_multi, freq);
|
||||
dprintk("REFDIV: %hd, FREF: %d\n", REFDIV, FREF);
|
||||
dprintk("FBDIV: %d, Rest: %d\n", FBDiv, Rest);
|
||||
dprintk("Num: %hd, Den: %hd, SD: %hd\n", (u16) Rest, Den, (state->lo4 >> 12) & 0x1);
|
||||
dprintk("HFDIV code: %hd\n", state->current_tune_table_index->hfdiv);
|
||||
dprintk("VCO = %hd\n", state->current_tune_table_index->vco_band);
|
||||
dprintk("VCOF: ((%hd*%d) << 1))\n", state->current_tune_table_index->vco_multi, freq);
|
||||
|
||||
*tune_state = CT_TUNER_STEP_0;
|
||||
} else { /* we are already tuned to this frequency - the configuration is correct */
|
||||
@@ -625,7 +625,7 @@ static void dib0070_wbd_offset_calibration(struct dib0070_state *state)
|
||||
u8 gain;
|
||||
for (gain = 6; gain < 8; gain++) {
|
||||
state->wbd_offset_3_3[gain - 6] = ((dib0070_read_wbd_offset(state, gain) * 8 * 18 / 33 + 1) / 2);
|
||||
dprintk("Gain: %d, WBDOffset (3.3V) = %hd", gain, state->wbd_offset_3_3[gain-6]);
|
||||
dprintk("Gain: %d, WBDOffset (3.3V) = %hd\n", gain, state->wbd_offset_3_3[gain-6]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,10 +665,10 @@ static int dib0070_reset(struct dvb_frontend *fe)
|
||||
state->revision = DIB0070S_P1A;
|
||||
|
||||
/* P1F or not */
|
||||
dprintk("Revision: %x", state->revision);
|
||||
dprintk("Revision: %x\n", state->revision);
|
||||
|
||||
if (state->revision == DIB0070_P1D) {
|
||||
dprintk("Error: this driver is not to be used meant for P1D or earlier");
|
||||
dprintk("Error: this driver is not to be used meant for P1D or earlier\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -722,11 +722,10 @@ static int dib0070_get_frequency(struct dvb_frontend *fe, u32 *frequency)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dib0070_release(struct dvb_frontend *fe)
|
||||
static void dib0070_release(struct dvb_frontend *fe)
|
||||
{
|
||||
kfree(fe->tuner_priv);
|
||||
fe->tuner_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dvb_tuner_ops dib0070_ops = {
|
||||
@@ -761,7 +760,7 @@ struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter
|
||||
if (dib0070_reset(fe) != 0)
|
||||
goto free_mem;
|
||||
|
||||
printk(KERN_INFO "DiB0070: successfully identified\n");
|
||||
pr_info("DiB0070: successfully identified\n");
|
||||
memcpy(&fe->ops.tuner_ops, &dib0070_ops, sizeof(struct dvb_tuner_ops));
|
||||
|
||||
fe->tuner_priv = state;
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -38,12 +40,10 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { \
|
||||
if (debug) { \
|
||||
printk(KERN_DEBUG "DiB0090: "); \
|
||||
printk(args); \
|
||||
printk("\n"); \
|
||||
} \
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
#define CONFIG_SYS_DVBT
|
||||
@@ -218,7 +218,7 @@ static u16 dib0090_read_reg(struct dib0090_state *state, u8 reg)
|
||||
u16 ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ static u16 dib0090_read_reg(struct dib0090_state *state, u8 reg)
|
||||
state->msg[1].len = 2;
|
||||
|
||||
if (i2c_transfer(state->i2c, state->msg, 2) != 2) {
|
||||
printk(KERN_WARNING "DiB0090 I2C read failed\n");
|
||||
pr_warn("DiB0090 I2C read failed\n");
|
||||
ret = 0;
|
||||
} else
|
||||
ret = (state->i2c_read_buffer[0] << 8)
|
||||
@@ -250,7 +250,7 @@ static int dib0090_write_reg(struct dib0090_state *state, u32 reg, u16 val)
|
||||
int ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ static int dib0090_write_reg(struct dib0090_state *state, u32 reg, u16 val)
|
||||
state->msg[0].len = 3;
|
||||
|
||||
if (i2c_transfer(state->i2c, state->msg, 1) != 1) {
|
||||
printk(KERN_WARNING "DiB0090 I2C write failed\n");
|
||||
pr_warn("DiB0090 I2C write failed\n");
|
||||
ret = -EREMOTEIO;
|
||||
} else
|
||||
ret = 0;
|
||||
@@ -279,7 +279,7 @@ static u16 dib0090_fw_read_reg(struct dib0090_fw_state *state, u8 reg)
|
||||
u16 ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ static u16 dib0090_fw_read_reg(struct dib0090_fw_state *state, u8 reg)
|
||||
state->msg.buf = state->i2c_read_buffer;
|
||||
state->msg.len = 2;
|
||||
if (i2c_transfer(state->i2c, &state->msg, 1) != 1) {
|
||||
printk(KERN_WARNING "DiB0090 I2C read failed\n");
|
||||
pr_warn("DiB0090 I2C read failed\n");
|
||||
ret = 0;
|
||||
} else
|
||||
ret = (state->i2c_read_buffer[0] << 8)
|
||||
@@ -306,7 +306,7 @@ static int dib0090_fw_write_reg(struct dib0090_fw_state *state, u8 reg, u16 val)
|
||||
int ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ static int dib0090_fw_write_reg(struct dib0090_fw_state *state, u8 reg, u16 val)
|
||||
state->msg.buf = state->i2c_write_buffer;
|
||||
state->msg.len = 2;
|
||||
if (i2c_transfer(state->i2c, &state->msg, 1) != 1) {
|
||||
printk(KERN_WARNING "DiB0090 I2C write failed\n");
|
||||
pr_warn("DiB0090 I2C write failed\n");
|
||||
ret = -EREMOTEIO;
|
||||
} else
|
||||
ret = 0;
|
||||
@@ -351,7 +351,7 @@ static int dib0090_identify(struct dvb_frontend *fe)
|
||||
identity->p1g = 0;
|
||||
identity->in_soc = 0;
|
||||
|
||||
dprintk("Tuner identification (Version = 0x%04x)", v);
|
||||
dprintk("Tuner identification (Version = 0x%04x)\n", v);
|
||||
|
||||
/* without PLL lock info */
|
||||
v &= ~KROSUS_PLL_LOCKED;
|
||||
@@ -366,19 +366,19 @@ static int dib0090_identify(struct dvb_frontend *fe)
|
||||
identity->in_soc = 1;
|
||||
switch (identity->version) {
|
||||
case SOC_8090_P1G_11R1:
|
||||
dprintk("SOC 8090 P1-G11R1 Has been detected");
|
||||
dprintk("SOC 8090 P1-G11R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case SOC_8090_P1G_21R1:
|
||||
dprintk("SOC 8090 P1-G21R1 Has been detected");
|
||||
dprintk("SOC 8090 P1-G21R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case SOC_7090_P1G_11R1:
|
||||
dprintk("SOC 7090 P1-G11R1 Has been detected");
|
||||
dprintk("SOC 7090 P1-G11R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case SOC_7090_P1G_21R1:
|
||||
dprintk("SOC 7090 P1-G21R1 Has been detected");
|
||||
dprintk("SOC 7090 P1-G21R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -387,16 +387,16 @@ static int dib0090_identify(struct dvb_frontend *fe)
|
||||
} else {
|
||||
switch ((identity->version >> 5) & 0x7) {
|
||||
case MP001:
|
||||
dprintk("MP001 : 9090/8096");
|
||||
dprintk("MP001 : 9090/8096\n");
|
||||
break;
|
||||
case MP005:
|
||||
dprintk("MP005 : Single Sband");
|
||||
dprintk("MP005 : Single Sband\n");
|
||||
break;
|
||||
case MP008:
|
||||
dprintk("MP008 : diversity VHF-UHF-LBAND");
|
||||
dprintk("MP008 : diversity VHF-UHF-LBAND\n");
|
||||
break;
|
||||
case MP009:
|
||||
dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND");
|
||||
dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND\n");
|
||||
break;
|
||||
default:
|
||||
goto identification_error;
|
||||
@@ -404,21 +404,21 @@ static int dib0090_identify(struct dvb_frontend *fe)
|
||||
|
||||
switch (identity->version & 0x1f) {
|
||||
case P1G_21R2:
|
||||
dprintk("P1G_21R2 detected");
|
||||
dprintk("P1G_21R2 detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case P1G:
|
||||
dprintk("P1G detected");
|
||||
dprintk("P1G detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case P1D_E_F:
|
||||
dprintk("P1D/E/F detected");
|
||||
dprintk("P1D/E/F detected\n");
|
||||
break;
|
||||
case P1C:
|
||||
dprintk("P1C detected");
|
||||
dprintk("P1C detected\n");
|
||||
break;
|
||||
case P1A_B:
|
||||
dprintk("P1-A/B detected: driver is deactivated - not available");
|
||||
dprintk("P1-A/B detected: driver is deactivated - not available\n");
|
||||
goto identification_error;
|
||||
break;
|
||||
default:
|
||||
@@ -441,7 +441,7 @@ static int dib0090_fw_identify(struct dvb_frontend *fe)
|
||||
identity->p1g = 0;
|
||||
identity->in_soc = 0;
|
||||
|
||||
dprintk("FE: Tuner identification (Version = 0x%04x)", v);
|
||||
dprintk("FE: Tuner identification (Version = 0x%04x)\n", v);
|
||||
|
||||
/* without PLL lock info */
|
||||
v &= ~KROSUS_PLL_LOCKED;
|
||||
@@ -456,19 +456,19 @@ static int dib0090_fw_identify(struct dvb_frontend *fe)
|
||||
identity->in_soc = 1;
|
||||
switch (identity->version) {
|
||||
case SOC_8090_P1G_11R1:
|
||||
dprintk("SOC 8090 P1-G11R1 Has been detected");
|
||||
dprintk("SOC 8090 P1-G11R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case SOC_8090_P1G_21R1:
|
||||
dprintk("SOC 8090 P1-G21R1 Has been detected");
|
||||
dprintk("SOC 8090 P1-G21R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case SOC_7090_P1G_11R1:
|
||||
dprintk("SOC 7090 P1-G11R1 Has been detected");
|
||||
dprintk("SOC 7090 P1-G11R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case SOC_7090_P1G_21R1:
|
||||
dprintk("SOC 7090 P1-G21R1 Has been detected");
|
||||
dprintk("SOC 7090 P1-G21R1 Has been detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
default:
|
||||
@@ -477,16 +477,16 @@ static int dib0090_fw_identify(struct dvb_frontend *fe)
|
||||
} else {
|
||||
switch ((identity->version >> 5) & 0x7) {
|
||||
case MP001:
|
||||
dprintk("MP001 : 9090/8096");
|
||||
dprintk("MP001 : 9090/8096\n");
|
||||
break;
|
||||
case MP005:
|
||||
dprintk("MP005 : Single Sband");
|
||||
dprintk("MP005 : Single Sband\n");
|
||||
break;
|
||||
case MP008:
|
||||
dprintk("MP008 : diversity VHF-UHF-LBAND");
|
||||
dprintk("MP008 : diversity VHF-UHF-LBAND\n");
|
||||
break;
|
||||
case MP009:
|
||||
dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND");
|
||||
dprintk("MP009 : diversity 29098 CBAND-UHF-LBAND-SBAND\n");
|
||||
break;
|
||||
default:
|
||||
goto identification_error;
|
||||
@@ -494,21 +494,21 @@ static int dib0090_fw_identify(struct dvb_frontend *fe)
|
||||
|
||||
switch (identity->version & 0x1f) {
|
||||
case P1G_21R2:
|
||||
dprintk("P1G_21R2 detected");
|
||||
dprintk("P1G_21R2 detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case P1G:
|
||||
dprintk("P1G detected");
|
||||
dprintk("P1G detected\n");
|
||||
identity->p1g = 1;
|
||||
break;
|
||||
case P1D_E_F:
|
||||
dprintk("P1D/E/F detected");
|
||||
dprintk("P1D/E/F detected\n");
|
||||
break;
|
||||
case P1C:
|
||||
dprintk("P1C detected");
|
||||
dprintk("P1C detected\n");
|
||||
break;
|
||||
case P1A_B:
|
||||
dprintk("P1-A/B detected: driver is deactivated - not available");
|
||||
dprintk("P1-A/B detected: driver is deactivated - not available\n");
|
||||
goto identification_error;
|
||||
break;
|
||||
default:
|
||||
@@ -574,7 +574,7 @@ static void dib0090_reset_digital(struct dvb_frontend *fe, const struct dib0090_
|
||||
} while (--i);
|
||||
|
||||
if (i == 0) {
|
||||
dprintk("Pll: Unable to lock Pll");
|
||||
dprintk("Pll: Unable to lock Pll\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -596,7 +596,7 @@ static int dib0090_fw_reset_digital(struct dvb_frontend *fe, const struct dib009
|
||||
u16 v;
|
||||
int i;
|
||||
|
||||
dprintk("fw reset digital");
|
||||
dprintk("fw reset digital\n");
|
||||
HARD_RESET(state);
|
||||
|
||||
dib0090_fw_write_reg(state, 0x24, EN_PLL | EN_CRYSTAL);
|
||||
@@ -645,7 +645,7 @@ static int dib0090_fw_reset_digital(struct dvb_frontend *fe, const struct dib009
|
||||
} while (--i);
|
||||
|
||||
if (i == 0) {
|
||||
dprintk("Pll: Unable to lock Pll");
|
||||
dprintk("Pll: Unable to lock Pll\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -922,7 +922,7 @@ static void dib0090_wbd_target(struct dib0090_state *state, u32 rf)
|
||||
#endif
|
||||
|
||||
state->wbd_target = dib0090_wbd_to_db(state, state->wbd_offset + offset);
|
||||
dprintk("wbd-target: %d dB", (u32) state->wbd_target);
|
||||
dprintk("wbd-target: %d dB\n", (u32) state->wbd_target);
|
||||
}
|
||||
|
||||
static const int gain_reg_addr[4] = {
|
||||
@@ -1019,7 +1019,7 @@ static void dib0090_gain_apply(struct dib0090_state *state, s16 gain_delta, s16
|
||||
gain_reg[3] |= ((bb % 10) * 100) / 125;
|
||||
|
||||
#ifdef DEBUG_AGC
|
||||
dprintk("GA CALC: DB: %3d(rf) + %3d(bb) = %3d gain_reg[0]=%04x gain_reg[1]=%04x gain_reg[2]=%04x gain_reg[0]=%04x", rf, bb, rf + bb,
|
||||
dprintk("GA CALC: DB: %3d(rf) + %3d(bb) = %3d gain_reg[0]=%04x gain_reg[1]=%04x gain_reg[2]=%04x gain_reg[0]=%04x\n", rf, bb, rf + bb,
|
||||
gain_reg[0], gain_reg[1], gain_reg[2], gain_reg[3]);
|
||||
#endif
|
||||
|
||||
@@ -1050,7 +1050,7 @@ static void dib0090_set_rframp_pwm(struct dib0090_state *state, const u16 * cfg)
|
||||
|
||||
dib0090_write_reg(state, 0x2a, 0xffff);
|
||||
|
||||
dprintk("total RF gain: %ddB, step: %d", (u32) cfg[0], dib0090_read_reg(state, 0x2a));
|
||||
dprintk("total RF gain: %ddB, step: %d\n", (u32) cfg[0], dib0090_read_reg(state, 0x2a));
|
||||
|
||||
dib0090_write_regs(state, 0x2c, cfg + 3, 6);
|
||||
dib0090_write_regs(state, 0x3e, cfg + 9, 2);
|
||||
@@ -1069,7 +1069,7 @@ static void dib0090_set_bbramp_pwm(struct dib0090_state *state, const u16 * cfg)
|
||||
dib0090_set_boost(state, cfg[0] > 500); /* we want the boost if the gain is higher that 50dB */
|
||||
|
||||
dib0090_write_reg(state, 0x33, 0xffff);
|
||||
dprintk("total BB gain: %ddB, step: %d", (u32) cfg[0], dib0090_read_reg(state, 0x33));
|
||||
dprintk("total BB gain: %ddB, step: %d\n", (u32) cfg[0], dib0090_read_reg(state, 0x33));
|
||||
dib0090_write_regs(state, 0x35, cfg + 3, 4);
|
||||
}
|
||||
|
||||
@@ -1122,7 +1122,7 @@ void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
|
||||
|
||||
/* activate the ramp generator using PWM control */
|
||||
if (state->rf_ramp)
|
||||
dprintk("ramp RF gain = %d BAND = %s version = %d",
|
||||
dprintk("ramp RF gain = %d BAND = %s version = %d\n",
|
||||
state->rf_ramp[0],
|
||||
(state->current_band == BAND_CBAND) ? "CBAND" : "NOT CBAND",
|
||||
state->identity.version & 0x1f);
|
||||
@@ -1130,10 +1130,10 @@ void dib0090_pwm_gain_reset(struct dvb_frontend *fe)
|
||||
if (rf_ramp && ((state->rf_ramp && state->rf_ramp[0] == 0) ||
|
||||
(state->current_band == BAND_CBAND &&
|
||||
(state->identity.version & 0x1f) <= P1D_E_F))) {
|
||||
dprintk("DE-Engage mux for direct gain reg control");
|
||||
dprintk("DE-Engage mux for direct gain reg control\n");
|
||||
en_pwm_rf_mux = 0;
|
||||
} else
|
||||
dprintk("Engage mux for PWM control");
|
||||
dprintk("Engage mux for PWM control\n");
|
||||
|
||||
dib0090_write_reg(state, 0x32, (en_pwm_rf_mux << 12) | (en_pwm_rf_mux << 11));
|
||||
|
||||
@@ -1352,7 +1352,7 @@ u16 dib0090_get_wbd_target(struct dvb_frontend *fe)
|
||||
while (f_MHz > wbd->max_freq)
|
||||
wbd++;
|
||||
|
||||
dprintk("using wbd-table-entry with max freq %d", wbd->max_freq);
|
||||
dprintk("using wbd-table-entry with max freq %d\n", wbd->max_freq);
|
||||
|
||||
if (current_temp < 0)
|
||||
current_temp = 0;
|
||||
@@ -1373,8 +1373,8 @@ u16 dib0090_get_wbd_target(struct dvb_frontend *fe)
|
||||
wbd_tcold += ((wbd_thot - wbd_tcold) * current_temp) >> 7;
|
||||
|
||||
state->wbd_target = dib0090_wbd_to_db(state, state->wbd_offset + wbd_tcold);
|
||||
dprintk("wbd-target: %d dB", (u32) state->wbd_target);
|
||||
dprintk("wbd offset applied is %d", wbd_tcold);
|
||||
dprintk("wbd-target: %d dB\n", (u32) state->wbd_target);
|
||||
dprintk("wbd offset applied is %d\n", wbd_tcold);
|
||||
|
||||
return state->wbd_offset + wbd_tcold;
|
||||
}
|
||||
@@ -1415,7 +1415,7 @@ int dib0090_update_rframp_7090(struct dvb_frontend *fe, u8 cfg_sensitivity)
|
||||
if ((!state->identity.p1g) || (!state->identity.in_soc)
|
||||
|| ((state->identity.version != SOC_7090_P1G_21R1)
|
||||
&& (state->identity.version != SOC_7090_P1G_11R1))) {
|
||||
dprintk("%s() function can only be used for dib7090P", __func__);
|
||||
dprintk("%s() function can only be used for dib7090P\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -1598,7 +1598,7 @@ static int dib0090_reset(struct dvb_frontend *fe)
|
||||
dib0090_write_reg(state, 0x14, 1);
|
||||
else
|
||||
dib0090_write_reg(state, 0x14, 2);
|
||||
dprintk("Pll lock : %d", (dib0090_read_reg(state, 0x1a) >> 11) & 0x1);
|
||||
dprintk("Pll lock : %d\n", (dib0090_read_reg(state, 0x1a) >> 11) & 0x1);
|
||||
|
||||
state->calibrate = DC_CAL | WBD_CAL | TEMP_CAL; /* enable iq-offset-calibration and wbd-calibration when tuning next time */
|
||||
|
||||
@@ -1711,7 +1711,8 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front
|
||||
|
||||
/* fall through */
|
||||
case CT_TUNER_STEP_0:
|
||||
dprintk("Start/continue DC calibration for %s path", (state->dc->i == 1) ? "I" : "Q");
|
||||
dprintk("Start/continue DC calibration for %s path\n",
|
||||
(state->dc->i == 1) ? "I" : "Q");
|
||||
dib0090_write_reg(state, 0x01, state->dc->bb1);
|
||||
dib0090_write_reg(state, 0x07, state->bb7 | (state->dc->i << 7));
|
||||
|
||||
@@ -1733,13 +1734,13 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front
|
||||
break;
|
||||
|
||||
case CT_TUNER_STEP_5: /* found an offset */
|
||||
dprintk("adc_diff = %d, current step= %d", (u32) state->adc_diff, state->step);
|
||||
dprintk("adc_diff = %d, current step= %d\n", (u32) state->adc_diff, state->step);
|
||||
if (state->step == 0 && state->adc_diff < 0) {
|
||||
state->min_adc_diff = -1023;
|
||||
dprintk("Change of sign of the minimum adc diff");
|
||||
dprintk("Change of sign of the minimum adc diff\n");
|
||||
}
|
||||
|
||||
dprintk("adc_diff = %d, min_adc_diff = %d current_step = %d", state->adc_diff, state->min_adc_diff, state->step);
|
||||
dprintk("adc_diff = %d, min_adc_diff = %d current_step = %d\n", state->adc_diff, state->min_adc_diff, state->step);
|
||||
|
||||
/* first turn for this frequency */
|
||||
if (state->step == 0) {
|
||||
@@ -1758,12 +1759,12 @@ static int dib0090_dc_offset_calibration(struct dib0090_state *state, enum front
|
||||
} else {
|
||||
/* the minimum was what we have seen in the step before */
|
||||
if (ABS(state->adc_diff) > ABS(state->min_adc_diff)) {
|
||||
dprintk("Since adc_diff N = %d > adc_diff step N-1 = %d, Come back one step", state->adc_diff, state->min_adc_diff);
|
||||
dprintk("Since adc_diff N = %d > adc_diff step N-1 = %d, Come back one step\n", state->adc_diff, state->min_adc_diff);
|
||||
state->step--;
|
||||
}
|
||||
|
||||
dib0090_set_trim(state);
|
||||
dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd", state->dc->addr, state->adc_diff, state->step);
|
||||
dprintk("BB Offset Cal, BBreg=%hd,Offset=%hd,Value Set=%hd\n", state->dc->addr, state->adc_diff, state->step);
|
||||
|
||||
state->dc++;
|
||||
if (state->dc->addr == 0) /* done */
|
||||
@@ -1819,7 +1820,7 @@ static int dib0090_wbd_calibration(struct dib0090_state *state, enum frontend_tu
|
||||
|
||||
case CT_TUNER_STEP_0:
|
||||
state->wbd_offset = dib0090_get_slow_adc_val(state);
|
||||
dprintk("WBD calibration offset = %d", state->wbd_offset);
|
||||
dprintk("WBD calibration offset = %d\n", state->wbd_offset);
|
||||
*tune_state = CT_TUNER_START; /* reset done -> real tuning can now begin */
|
||||
state->calibrate &= ~WBD_CAL;
|
||||
break;
|
||||
@@ -2064,7 +2065,7 @@ int dib0090_update_tuning_table_7090(struct dvb_frontend *fe,
|
||||
if ((!state->identity.p1g) || (!state->identity.in_soc)
|
||||
|| ((state->identity.version != SOC_7090_P1G_21R1)
|
||||
&& (state->identity.version != SOC_7090_P1G_11R1))) {
|
||||
dprintk("%s() function can only be used for dib7090", __func__);
|
||||
dprintk("%s() function can only be used for dib7090\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -2098,7 +2099,8 @@ static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tun
|
||||
force_soft_search = 1;
|
||||
|
||||
if (*tune_state == CT_TUNER_START) {
|
||||
dprintk("Start Captrim search : %s", (force_soft_search == 1) ? "FORCE SOFT SEARCH" : "AUTO");
|
||||
dprintk("Start Captrim search : %s\n",
|
||||
(force_soft_search == 1) ? "FORCE SOFT SEARCH" : "AUTO");
|
||||
dib0090_write_reg(state, 0x10, 0x2B1);
|
||||
dib0090_write_reg(state, 0x1e, 0x0032);
|
||||
|
||||
@@ -2140,13 +2142,13 @@ static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tun
|
||||
dib0090_read_reg(state, 0x40);
|
||||
|
||||
state->fcaptrim = dib0090_read_reg(state, 0x18) & 0x7F;
|
||||
dprintk("***Final Captrim= 0x%x", state->fcaptrim);
|
||||
dprintk("***Final Captrim= 0x%x\n", state->fcaptrim);
|
||||
*tune_state = CT_TUNER_STEP_3;
|
||||
|
||||
} else {
|
||||
/* MERGE for all krosus before P1G */
|
||||
adc = dib0090_get_slow_adc_val(state);
|
||||
dprintk("CAPTRIM=%d; ADC = %d (ADC) & %dmV", (u32) state->captrim, (u32) adc, (u32) (adc) * (u32) 1800 / (u32) 1024);
|
||||
dprintk("CAPTRIM=%d; ADC = %d (ADC) & %dmV\n", (u32) state->captrim, (u32) adc, (u32) (adc) * (u32) 1800 / (u32) 1024);
|
||||
|
||||
if (state->rest == 0 || state->identity.in_soc) { /* Just for 8090P SOCS where auto captrim HW bug : TO CHECK IN ACI for SOCS !!! if 400 for 8090p SOC => tune issue !!! */
|
||||
adc_target = 200;
|
||||
@@ -2162,7 +2164,7 @@ static int dib0090_captrim_search(struct dib0090_state *state, enum frontend_tun
|
||||
}
|
||||
|
||||
if (adc < state->adc_diff) {
|
||||
dprintk("CAPTRIM=%d is closer to target (%d/%d)", (u32) state->captrim, (u32) adc, (u32) state->adc_diff);
|
||||
dprintk("CAPTRIM=%d is closer to target (%d/%d)\n", (u32) state->captrim, (u32) adc, (u32) state->adc_diff);
|
||||
state->adc_diff = adc;
|
||||
state->fcaptrim = state->captrim;
|
||||
}
|
||||
@@ -2216,7 +2218,7 @@ static int dib0090_get_temperature(struct dib0090_state *state, enum frontend_tu
|
||||
val = dib0090_get_slow_adc_val(state);
|
||||
state->temperature = ((s16) ((val - state->adc_diff) * 180) >> 8) + 55;
|
||||
|
||||
dprintk("temperature: %d C", state->temperature - 30);
|
||||
dprintk("temperature: %d C\n", state->temperature - 30);
|
||||
|
||||
*tune_state = CT_TUNER_STEP_2;
|
||||
break;
|
||||
@@ -2478,13 +2480,13 @@ static int dib0090_tune(struct dvb_frontend *fe)
|
||||
wbd++;
|
||||
|
||||
dib0090_write_reg(state, 0x1e, 0x07ff);
|
||||
dprintk("Final Captrim: %d", (u32) state->fcaptrim);
|
||||
dprintk("HFDIV code: %d", (u32) pll->hfdiv_code);
|
||||
dprintk("VCO = %d", (u32) pll->vco_band);
|
||||
dprintk("VCOF in kHz: %d ((%d*%d) << 1))", (u32) ((pll->hfdiv * state->rf_request) * 2), (u32) pll->hfdiv, (u32) state->rf_request);
|
||||
dprintk("REFDIV: %d, FREF: %d", (u32) 1, (u32) state->config->io.clock_khz);
|
||||
dprintk("FBDIV: %d, Rest: %d", (u32) dib0090_read_reg(state, 0x15), (u32) dib0090_read_reg(state, 0x17));
|
||||
dprintk("Num: %d, Den: %d, SD: %d", (u32) dib0090_read_reg(state, 0x17), (u32) (dib0090_read_reg(state, 0x16) >> 8),
|
||||
dprintk("Final Captrim: %d\n", (u32) state->fcaptrim);
|
||||
dprintk("HFDIV code: %d\n", (u32) pll->hfdiv_code);
|
||||
dprintk("VCO = %d\n", (u32) pll->vco_band);
|
||||
dprintk("VCOF in kHz: %d ((%d*%d) << 1))\n", (u32) ((pll->hfdiv * state->rf_request) * 2), (u32) pll->hfdiv, (u32) state->rf_request);
|
||||
dprintk("REFDIV: %d, FREF: %d\n", (u32) 1, (u32) state->config->io.clock_khz);
|
||||
dprintk("FBDIV: %d, Rest: %d\n", (u32) dib0090_read_reg(state, 0x15), (u32) dib0090_read_reg(state, 0x17));
|
||||
dprintk("Num: %d, Den: %d, SD: %d\n", (u32) dib0090_read_reg(state, 0x17), (u32) (dib0090_read_reg(state, 0x16) >> 8),
|
||||
(u32) dib0090_read_reg(state, 0x1c) & 0x3);
|
||||
|
||||
#define WBD 0x781 /* 1 1 1 1 0000 0 0 1 */
|
||||
@@ -2498,7 +2500,7 @@ static int dib0090_tune(struct dvb_frontend *fe)
|
||||
dib0090_write_reg(state, 0x10, state->wbdmux);
|
||||
|
||||
if ((tune->tuner_enable == EN_CAB) && state->identity.p1g) {
|
||||
dprintk("P1G : The cable band is selected and lna_tune = %d", tune->lna_tune);
|
||||
dprintk("P1G : The cable band is selected and lna_tune = %d\n", tune->lna_tune);
|
||||
dib0090_write_reg(state, 0x09, tune->lna_bias);
|
||||
dib0090_write_reg(state, 0x0b, 0xb800 | (tune->lna_tune << 6) | (tune->switch_trim));
|
||||
} else
|
||||
@@ -2524,11 +2526,10 @@ static int dib0090_tune(struct dvb_frontend *fe)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dib0090_release(struct dvb_frontend *fe)
|
||||
static void dib0090_release(struct dvb_frontend *fe)
|
||||
{
|
||||
kfree(fe->tuner_priv);
|
||||
fe->tuner_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum frontend_tune_state dib0090_get_tune_state(struct dvb_frontend *fe)
|
||||
@@ -2643,7 +2644,7 @@ struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapte
|
||||
if (dib0090_reset(fe) != 0)
|
||||
goto free_mem;
|
||||
|
||||
printk(KERN_INFO "DiB0090: successfully identified\n");
|
||||
pr_info("DiB0090: successfully identified\n");
|
||||
memcpy(&fe->ops.tuner_ops, &dib0090_ops, sizeof(struct dvb_tuner_ops));
|
||||
|
||||
return fe;
|
||||
@@ -2670,7 +2671,7 @@ struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_ada
|
||||
if (dib0090_fw_reset_digital(fe, st->config) != 0)
|
||||
goto free_mem;
|
||||
|
||||
dprintk("DiB0090 FW: successfully identified");
|
||||
dprintk("DiB0090 FW: successfully identified\n");
|
||||
memcpy(&fe->ops.tuner_ops, &dib0090_fw_ops, sizeof(struct dvb_tuner_ops));
|
||||
|
||||
return fe;
|
||||
|
@@ -21,6 +21,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
@@ -42,13 +44,13 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-able)).");
|
||||
|
||||
#define deb_info(args...) dprintk(0x01,args)
|
||||
#define deb_i2c(args...) dprintk(0x02,args)
|
||||
#define deb_srch(args...) dprintk(0x04,args)
|
||||
#define deb_info(args...) dprintk(0x01,args)
|
||||
#define deb_xfer(args...) dprintk(0x02,args)
|
||||
#define deb_setf(args...) dprintk(0x04,args)
|
||||
#define deb_getf(args...) dprintk(0x08,args)
|
||||
#define deb_info(args...) dprintk(0x01, args)
|
||||
#define deb_i2c(args...) dprintk(0x02, args)
|
||||
#define deb_srch(args...) dprintk(0x04, args)
|
||||
#define deb_info(args...) dprintk(0x01, args)
|
||||
#define deb_xfer(args...) dprintk(0x02, args)
|
||||
#define deb_setf(args...) dprintk(0x04, args)
|
||||
#define deb_getf(args...) dprintk(0x08, args)
|
||||
|
||||
static int dib3000_read_reg(struct dib3000_state *state, u16 reg)
|
||||
{
|
||||
@@ -126,103 +128,96 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner)
|
||||
fe->ops.tuner_ops.set_params(fe);
|
||||
if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
|
||||
|
||||
deb_setf("bandwidth: ");
|
||||
switch (c->bandwidth_hz) {
|
||||
case 8000000:
|
||||
deb_setf("8 MHz\n");
|
||||
wr_foreach(dib3000mb_reg_timing_freq, dib3000mb_timing_freq[2]);
|
||||
wr_foreach(dib3000mb_reg_bandwidth, dib3000mb_bandwidth_8mhz);
|
||||
break;
|
||||
case 7000000:
|
||||
deb_setf("7 MHz\n");
|
||||
wr_foreach(dib3000mb_reg_timing_freq, dib3000mb_timing_freq[1]);
|
||||
wr_foreach(dib3000mb_reg_bandwidth, dib3000mb_bandwidth_7mhz);
|
||||
break;
|
||||
case 6000000:
|
||||
deb_setf("6 MHz\n");
|
||||
wr_foreach(dib3000mb_reg_timing_freq, dib3000mb_timing_freq[0]);
|
||||
wr_foreach(dib3000mb_reg_bandwidth, dib3000mb_bandwidth_6mhz);
|
||||
break;
|
||||
case 0:
|
||||
return -EOPNOTSUPP;
|
||||
default:
|
||||
err("unknown bandwidth value.");
|
||||
pr_err("unknown bandwidth value.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
deb_setf("bandwidth: %d MHZ\n", c->bandwidth_hz / 1000000);
|
||||
}
|
||||
wr(DIB3000MB_REG_LOCK1_MASK, DIB3000MB_LOCK1_SEARCH_4);
|
||||
|
||||
deb_setf("transmission mode: ");
|
||||
switch (c->transmission_mode) {
|
||||
case TRANSMISSION_MODE_2K:
|
||||
deb_setf("2k\n");
|
||||
deb_setf("transmission mode: 2k\n");
|
||||
wr(DIB3000MB_REG_FFT, DIB3000_TRANSMISSION_MODE_2K);
|
||||
break;
|
||||
case TRANSMISSION_MODE_8K:
|
||||
deb_setf("8k\n");
|
||||
deb_setf("transmission mode: 8k\n");
|
||||
wr(DIB3000MB_REG_FFT, DIB3000_TRANSMISSION_MODE_8K);
|
||||
break;
|
||||
case TRANSMISSION_MODE_AUTO:
|
||||
deb_setf("auto\n");
|
||||
deb_setf("transmission mode: auto\n");
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
deb_setf("guard: ");
|
||||
switch (c->guard_interval) {
|
||||
case GUARD_INTERVAL_1_32:
|
||||
deb_setf("1_32\n");
|
||||
deb_setf("guard 1_32\n");
|
||||
wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_32);
|
||||
break;
|
||||
case GUARD_INTERVAL_1_16:
|
||||
deb_setf("1_16\n");
|
||||
deb_setf("guard 1_16\n");
|
||||
wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_16);
|
||||
break;
|
||||
case GUARD_INTERVAL_1_8:
|
||||
deb_setf("1_8\n");
|
||||
deb_setf("guard 1_8\n");
|
||||
wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_8);
|
||||
break;
|
||||
case GUARD_INTERVAL_1_4:
|
||||
deb_setf("1_4\n");
|
||||
deb_setf("guard 1_4\n");
|
||||
wr(DIB3000MB_REG_GUARD_TIME, DIB3000_GUARD_TIME_1_4);
|
||||
break;
|
||||
case GUARD_INTERVAL_AUTO:
|
||||
deb_setf("auto\n");
|
||||
deb_setf("guard auto\n");
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
deb_setf("inversion: ");
|
||||
switch (c->inversion) {
|
||||
case INVERSION_OFF:
|
||||
deb_setf("off\n");
|
||||
deb_setf("inversion off\n");
|
||||
wr(DIB3000MB_REG_DDS_INV, DIB3000_DDS_INVERSION_OFF);
|
||||
break;
|
||||
case INVERSION_AUTO:
|
||||
deb_setf("auto ");
|
||||
deb_setf("inversion auto\n");
|
||||
break;
|
||||
case INVERSION_ON:
|
||||
deb_setf("on\n");
|
||||
deb_setf("inversion on\n");
|
||||
wr(DIB3000MB_REG_DDS_INV, DIB3000_DDS_INVERSION_ON);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
deb_setf("modulation: ");
|
||||
switch (c->modulation) {
|
||||
case QPSK:
|
||||
deb_setf("qpsk\n");
|
||||
deb_setf("modulation: qpsk\n");
|
||||
wr(DIB3000MB_REG_QAM, DIB3000_CONSTELLATION_QPSK);
|
||||
break;
|
||||
case QAM_16:
|
||||
deb_setf("qam16\n");
|
||||
deb_setf("modulation: qam16\n");
|
||||
wr(DIB3000MB_REG_QAM, DIB3000_CONSTELLATION_16QAM);
|
||||
break;
|
||||
case QAM_64:
|
||||
deb_setf("qam64\n");
|
||||
deb_setf("modulation: qam64\n");
|
||||
wr(DIB3000MB_REG_QAM, DIB3000_CONSTELLATION_64QAM);
|
||||
break;
|
||||
case QAM_AUTO:
|
||||
@@ -230,69 +225,64 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner)
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
deb_setf("hierarchy: ");
|
||||
switch (c->hierarchy) {
|
||||
case HIERARCHY_NONE:
|
||||
deb_setf("none ");
|
||||
deb_setf("hierarchy: none\n");
|
||||
/* fall through */
|
||||
case HIERARCHY_1:
|
||||
deb_setf("alpha=1\n");
|
||||
deb_setf("hierarchy: alpha=1\n");
|
||||
wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_1);
|
||||
break;
|
||||
case HIERARCHY_2:
|
||||
deb_setf("alpha=2\n");
|
||||
deb_setf("hierarchy: alpha=2\n");
|
||||
wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_2);
|
||||
break;
|
||||
case HIERARCHY_4:
|
||||
deb_setf("alpha=4\n");
|
||||
deb_setf("hierarchy: alpha=4\n");
|
||||
wr(DIB3000MB_REG_VIT_ALPHA, DIB3000_ALPHA_4);
|
||||
break;
|
||||
case HIERARCHY_AUTO:
|
||||
deb_setf("alpha=auto\n");
|
||||
deb_setf("hierarchy: alpha=auto\n");
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
deb_setf("hierarchy: ");
|
||||
if (c->hierarchy == HIERARCHY_NONE) {
|
||||
deb_setf("none\n");
|
||||
wr(DIB3000MB_REG_VIT_HRCH, DIB3000_HRCH_OFF);
|
||||
wr(DIB3000MB_REG_VIT_HP, DIB3000_SELECT_HP);
|
||||
fe_cr = c->code_rate_HP;
|
||||
} else if (c->hierarchy != HIERARCHY_AUTO) {
|
||||
deb_setf("on\n");
|
||||
wr(DIB3000MB_REG_VIT_HRCH, DIB3000_HRCH_ON);
|
||||
wr(DIB3000MB_REG_VIT_HP, DIB3000_SELECT_LP);
|
||||
fe_cr = c->code_rate_LP;
|
||||
}
|
||||
deb_setf("fec: ");
|
||||
switch (fe_cr) {
|
||||
case FEC_1_2:
|
||||
deb_setf("1_2\n");
|
||||
deb_setf("fec: 1_2\n");
|
||||
wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_1_2);
|
||||
break;
|
||||
case FEC_2_3:
|
||||
deb_setf("2_3\n");
|
||||
deb_setf("fec: 2_3\n");
|
||||
wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_2_3);
|
||||
break;
|
||||
case FEC_3_4:
|
||||
deb_setf("3_4\n");
|
||||
deb_setf("fec: 3_4\n");
|
||||
wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_3_4);
|
||||
break;
|
||||
case FEC_5_6:
|
||||
deb_setf("5_6\n");
|
||||
deb_setf("fec: 5_6\n");
|
||||
wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_5_6);
|
||||
break;
|
||||
case FEC_7_8:
|
||||
deb_setf("7_8\n");
|
||||
deb_setf("fec: 7_8\n");
|
||||
wr(DIB3000MB_REG_VIT_CODE_RATE, DIB3000_FEC_7_8);
|
||||
break;
|
||||
case FEC_NONE:
|
||||
deb_setf("none ");
|
||||
deb_setf("fec: none\n");
|
||||
break;
|
||||
case FEC_AUTO:
|
||||
deb_setf("auto\n");
|
||||
deb_setf("fec: auto\n");
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -357,7 +347,8 @@ static int dib3000mb_set_frontend(struct dvb_frontend *fe, int tuner)
|
||||
rd(DIB3000MB_REG_LOCK2_VALUE))) < 0 && as_count++ < 100)
|
||||
msleep(1);
|
||||
|
||||
deb_setf("search_state after autosearch %d after %d checks\n",search_state,as_count);
|
||||
deb_setf("search_state after autosearch %d after %d checks\n",
|
||||
search_state, as_count);
|
||||
|
||||
if (search_state == 1) {
|
||||
if (dib3000mb_get_frontend(fe, c) == 0) {
|
||||
@@ -464,7 +455,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe,
|
||||
return 0;
|
||||
|
||||
dds_val = ((rd(DIB3000MB_REG_DDS_VALUE_MSB) & 0xff) << 16) + rd(DIB3000MB_REG_DDS_VALUE_LSB);
|
||||
deb_getf("DDS_VAL: %x %x %x",dds_val, rd(DIB3000MB_REG_DDS_VALUE_MSB), rd(DIB3000MB_REG_DDS_VALUE_LSB));
|
||||
deb_getf("DDS_VAL: %x %x %x\n", dds_val, rd(DIB3000MB_REG_DDS_VALUE_MSB), rd(DIB3000MB_REG_DDS_VALUE_LSB));
|
||||
if (dds_val < threshold)
|
||||
inv_test1 = 0;
|
||||
else if (dds_val == threshold)
|
||||
@@ -473,7 +464,7 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe,
|
||||
inv_test1 = 2;
|
||||
|
||||
dds_val = ((rd(DIB3000MB_REG_DDS_FREQ_MSB) & 0xff) << 16) + rd(DIB3000MB_REG_DDS_FREQ_LSB);
|
||||
deb_getf("DDS_FREQ: %x %x %x",dds_val, rd(DIB3000MB_REG_DDS_FREQ_MSB), rd(DIB3000MB_REG_DDS_FREQ_LSB));
|
||||
deb_getf("DDS_FREQ: %x %x %x\n", dds_val, rd(DIB3000MB_REG_DDS_FREQ_MSB), rd(DIB3000MB_REG_DDS_FREQ_LSB));
|
||||
if (dds_val < threshold)
|
||||
inv_test2 = 0;
|
||||
else if (dds_val == threshold)
|
||||
@@ -490,19 +481,19 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe,
|
||||
|
||||
switch ((tps_val = rd(DIB3000MB_REG_TPS_QAM))) {
|
||||
case DIB3000_CONSTELLATION_QPSK:
|
||||
deb_getf("QPSK ");
|
||||
deb_getf("QPSK\n");
|
||||
c->modulation = QPSK;
|
||||
break;
|
||||
case DIB3000_CONSTELLATION_16QAM:
|
||||
deb_getf("QAM16 ");
|
||||
deb_getf("QAM16\n");
|
||||
c->modulation = QAM_16;
|
||||
break;
|
||||
case DIB3000_CONSTELLATION_64QAM:
|
||||
deb_getf("QAM64 ");
|
||||
deb_getf("QAM64\n");
|
||||
c->modulation = QAM_64;
|
||||
break;
|
||||
default:
|
||||
err("Unexpected constellation returned by TPS (%d)", tps_val);
|
||||
pr_err("Unexpected constellation returned by TPS (%d)\n", tps_val);
|
||||
break;
|
||||
}
|
||||
deb_getf("TPS: %d\n", tps_val);
|
||||
@@ -513,23 +504,23 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe,
|
||||
c->code_rate_HP = FEC_NONE;
|
||||
switch ((tps_val = rd(DIB3000MB_REG_TPS_VIT_ALPHA))) {
|
||||
case DIB3000_ALPHA_0:
|
||||
deb_getf("HIERARCHY_NONE ");
|
||||
deb_getf("HIERARCHY_NONE\n");
|
||||
c->hierarchy = HIERARCHY_NONE;
|
||||
break;
|
||||
case DIB3000_ALPHA_1:
|
||||
deb_getf("HIERARCHY_1 ");
|
||||
deb_getf("HIERARCHY_1\n");
|
||||
c->hierarchy = HIERARCHY_1;
|
||||
break;
|
||||
case DIB3000_ALPHA_2:
|
||||
deb_getf("HIERARCHY_2 ");
|
||||
deb_getf("HIERARCHY_2\n");
|
||||
c->hierarchy = HIERARCHY_2;
|
||||
break;
|
||||
case DIB3000_ALPHA_4:
|
||||
deb_getf("HIERARCHY_4 ");
|
||||
deb_getf("HIERARCHY_4\n");
|
||||
c->hierarchy = HIERARCHY_4;
|
||||
break;
|
||||
default:
|
||||
err("Unexpected ALPHA value returned by TPS (%d)", tps_val);
|
||||
pr_err("Unexpected ALPHA value returned by TPS (%d)\n", tps_val);
|
||||
break;
|
||||
}
|
||||
deb_getf("TPS: %d\n", tps_val);
|
||||
@@ -546,65 +537,65 @@ static int dib3000mb_get_frontend(struct dvb_frontend* fe,
|
||||
|
||||
switch (tps_val) {
|
||||
case DIB3000_FEC_1_2:
|
||||
deb_getf("FEC_1_2 ");
|
||||
deb_getf("FEC_1_2\n");
|
||||
*cr = FEC_1_2;
|
||||
break;
|
||||
case DIB3000_FEC_2_3:
|
||||
deb_getf("FEC_2_3 ");
|
||||
deb_getf("FEC_2_3\n");
|
||||
*cr = FEC_2_3;
|
||||
break;
|
||||
case DIB3000_FEC_3_4:
|
||||
deb_getf("FEC_3_4 ");
|
||||
deb_getf("FEC_3_4\n");
|
||||
*cr = FEC_3_4;
|
||||
break;
|
||||
case DIB3000_FEC_5_6:
|
||||
deb_getf("FEC_5_6 ");
|
||||
deb_getf("FEC_5_6\n");
|
||||
*cr = FEC_4_5;
|
||||
break;
|
||||
case DIB3000_FEC_7_8:
|
||||
deb_getf("FEC_7_8 ");
|
||||
deb_getf("FEC_7_8\n");
|
||||
*cr = FEC_7_8;
|
||||
break;
|
||||
default:
|
||||
err("Unexpected FEC returned by TPS (%d)", tps_val);
|
||||
pr_err("Unexpected FEC returned by TPS (%d)\n", tps_val);
|
||||
break;
|
||||
}
|
||||
deb_getf("TPS: %d\n",tps_val);
|
||||
|
||||
switch ((tps_val = rd(DIB3000MB_REG_TPS_GUARD_TIME))) {
|
||||
case DIB3000_GUARD_TIME_1_32:
|
||||
deb_getf("GUARD_INTERVAL_1_32 ");
|
||||
deb_getf("GUARD_INTERVAL_1_32\n");
|
||||
c->guard_interval = GUARD_INTERVAL_1_32;
|
||||
break;
|
||||
case DIB3000_GUARD_TIME_1_16:
|
||||
deb_getf("GUARD_INTERVAL_1_16 ");
|
||||
deb_getf("GUARD_INTERVAL_1_16\n");
|
||||
c->guard_interval = GUARD_INTERVAL_1_16;
|
||||
break;
|
||||
case DIB3000_GUARD_TIME_1_8:
|
||||
deb_getf("GUARD_INTERVAL_1_8 ");
|
||||
deb_getf("GUARD_INTERVAL_1_8\n");
|
||||
c->guard_interval = GUARD_INTERVAL_1_8;
|
||||
break;
|
||||
case DIB3000_GUARD_TIME_1_4:
|
||||
deb_getf("GUARD_INTERVAL_1_4 ");
|
||||
deb_getf("GUARD_INTERVAL_1_4\n");
|
||||
c->guard_interval = GUARD_INTERVAL_1_4;
|
||||
break;
|
||||
default:
|
||||
err("Unexpected Guard Time returned by TPS (%d)", tps_val);
|
||||
pr_err("Unexpected Guard Time returned by TPS (%d)\n", tps_val);
|
||||
break;
|
||||
}
|
||||
deb_getf("TPS: %d\n", tps_val);
|
||||
|
||||
switch ((tps_val = rd(DIB3000MB_REG_TPS_FFT))) {
|
||||
case DIB3000_TRANSMISSION_MODE_2K:
|
||||
deb_getf("TRANSMISSION_MODE_2K ");
|
||||
deb_getf("TRANSMISSION_MODE_2K\n");
|
||||
c->transmission_mode = TRANSMISSION_MODE_2K;
|
||||
break;
|
||||
case DIB3000_TRANSMISSION_MODE_8K:
|
||||
deb_getf("TRANSMISSION_MODE_8K ");
|
||||
deb_getf("TRANSMISSION_MODE_8K\n");
|
||||
c->transmission_mode = TRANSMISSION_MODE_8K;
|
||||
break;
|
||||
default:
|
||||
err("unexpected transmission mode return by TPS (%d)", tps_val);
|
||||
pr_err("unexpected transmission mode return by TPS (%d)\n", tps_val);
|
||||
break;
|
||||
}
|
||||
deb_getf("TPS: %d\n", tps_val);
|
||||
@@ -751,7 +742,7 @@ static int dib3000mb_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops dib3000mb_ops;
|
||||
static const struct dvb_frontend_ops dib3000mb_ops;
|
||||
|
||||
struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
|
||||
struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
|
||||
@@ -791,7 +782,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops dib3000mb_ops = {
|
||||
static const struct dvb_frontend_ops dib3000mb_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "DiBcom 3000M-B DVB-T",
|
||||
|
@@ -13,20 +13,15 @@
|
||||
#ifndef __DIB3000MB_PRIV_H_INCLUDED__
|
||||
#define __DIB3000MB_PRIV_H_INCLUDED__
|
||||
|
||||
/* info and err, taken from usb.h, if there is anything available like by default. */
|
||||
#define err(format, arg...) printk(KERN_ERR "dib3000: " format "\n" , ## arg)
|
||||
#define info(format, arg...) printk(KERN_INFO "dib3000: " format "\n" , ## arg)
|
||||
#define warn(format, arg...) printk(KERN_WARNING "dib3000: " format "\n" , ## arg)
|
||||
|
||||
/* handy shortcuts */
|
||||
#define rd(reg) dib3000_read_reg(state,reg)
|
||||
|
||||
#define wr(reg,val) if (dib3000_write_reg(state,reg,val)) \
|
||||
{ err("while sending 0x%04x to 0x%04x.",val,reg); return -EREMOTEIO; }
|
||||
{ pr_err("while sending 0x%04x to 0x%04x.", val, reg); return -EREMOTEIO; }
|
||||
|
||||
#define wr_foreach(a,v) { int i; \
|
||||
if (sizeof(a) != sizeof(v)) \
|
||||
err("sizeof: %zu %zu is different",sizeof(a),sizeof(v));\
|
||||
pr_err("sizeof: %zu %zu is different", sizeof(a), sizeof(v));\
|
||||
for (i=0; i < sizeof(a)/sizeof(u16); i++) \
|
||||
wr(a[i],v[i]); \
|
||||
}
|
||||
@@ -37,8 +32,11 @@
|
||||
|
||||
/* debug */
|
||||
|
||||
#define dprintk(level,args...) \
|
||||
do { if ((debug & level)) { printk(args); } } while (0)
|
||||
#define dprintk(level, fmt, arg...) do { \
|
||||
if (debug & level) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
/* mask for enabling a specific pid for the pid_filter */
|
||||
#define DIB3000_ACTIVATE_PID_FILTERING (0x2000)
|
||||
|
@@ -11,6 +11,8 @@
|
||||
* published by the Free Software Foundation, version 2.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -27,7 +29,11 @@ static int buggy_sfn_workaround;
|
||||
module_param(buggy_sfn_workaround, int, 0644);
|
||||
MODULE_PARM_DESC(buggy_sfn_workaround, "Enable work-around for buggy SFNs (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB3000MC/P:"); printk(args); printk("\n"); } } while (0)
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
struct dib3000mc_state {
|
||||
struct dvb_frontend demod;
|
||||
@@ -873,7 +879,7 @@ int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defa
|
||||
}
|
||||
EXPORT_SYMBOL(dib3000mc_i2c_enumeration);
|
||||
|
||||
static struct dvb_frontend_ops dib3000mc_ops;
|
||||
static const struct dvb_frontend_ops dib3000mc_ops;
|
||||
|
||||
struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg)
|
||||
{
|
||||
@@ -906,7 +912,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(dib3000mc_attach);
|
||||
|
||||
static struct dvb_frontend_ops dib3000mc_ops = {
|
||||
static const struct dvb_frontend_ops dib3000mc_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "DiBcom 3000MC/P",
|
||||
|
@@ -8,6 +8,9 @@
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, version 2.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -21,7 +24,11 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000M: "); printk(args); printk("\n"); } } while (0)
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
struct dib7000m_state {
|
||||
struct dvb_frontend demod;
|
||||
@@ -74,7 +81,7 @@ static u16 dib7000m_read_word(struct dib7000m_state *state, u16 reg)
|
||||
u16 ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -92,7 +99,7 @@ static u16 dib7000m_read_word(struct dib7000m_state *state, u16 reg)
|
||||
state->msg[1].len = 2;
|
||||
|
||||
if (i2c_transfer(state->i2c_adap, state->msg, 2) != 2)
|
||||
dprintk("i2c read error on %d",reg);
|
||||
dprintk("i2c read error on %d\n", reg);
|
||||
|
||||
ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1];
|
||||
mutex_unlock(&state->i2c_buffer_lock);
|
||||
@@ -105,7 +112,7 @@ static int dib7000m_write_word(struct dib7000m_state *state, u16 reg, u16 val)
|
||||
int ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -154,7 +161,7 @@ static int dib7000m_set_output_mode(struct dib7000m_state *state, int mode)
|
||||
fifo_threshold = 1792;
|
||||
smo_mode = (dib7000m_read_word(state, 294 + state->reg_offs) & 0x0010) | (1 << 1);
|
||||
|
||||
dprintk( "setting output mode for demod %p to %d", &state->demod, mode);
|
||||
dprintk("setting output mode for demod %p to %d\n", &state->demod, mode);
|
||||
|
||||
switch (mode) {
|
||||
case OUTMODE_MPEG2_PAR_GATED_CLK: // STBs with parallel gated clock
|
||||
@@ -181,7 +188,7 @@ static int dib7000m_set_output_mode(struct dib7000m_state *state, int mode)
|
||||
outreg = 0;
|
||||
break;
|
||||
default:
|
||||
dprintk( "Unhandled output_mode passed to be set for demod %p",&state->demod);
|
||||
dprintk("Unhandled output_mode passed to be set for demod %p\n", &state->demod);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -302,7 +309,7 @@ static int dib7000m_set_adc_state(struct dib7000m_state *state, enum dibx000_adc
|
||||
break;
|
||||
}
|
||||
|
||||
// dprintk( "913: %x, 914: %x", reg_913, reg_914);
|
||||
// dprintk("913: %x, 914: %x\n", reg_913, reg_914);
|
||||
ret |= dib7000m_write_word(state, 913, reg_913);
|
||||
ret |= dib7000m_write_word(state, 914, reg_914);
|
||||
|
||||
@@ -320,10 +327,10 @@ static int dib7000m_set_bandwidth(struct dib7000m_state *state, u32 bw)
|
||||
state->current_bandwidth = bw;
|
||||
|
||||
if (state->timf == 0) {
|
||||
dprintk( "using default timf");
|
||||
dprintk("using default timf\n");
|
||||
timf = state->timf_default;
|
||||
} else {
|
||||
dprintk( "using updated timf");
|
||||
dprintk("using updated timf\n");
|
||||
timf = state->timf;
|
||||
}
|
||||
|
||||
@@ -340,7 +347,7 @@ static int dib7000m_set_diversity_in(struct dvb_frontend *demod, int onoff)
|
||||
struct dib7000m_state *state = demod->demodulator_priv;
|
||||
|
||||
if (state->div_force_off) {
|
||||
dprintk( "diversity combination deactivated - forced by COFDM parameters");
|
||||
dprintk("diversity combination deactivated - forced by COFDM parameters\n");
|
||||
onoff = 0;
|
||||
}
|
||||
state->div_state = (u8)onoff;
|
||||
@@ -580,10 +587,10 @@ static int dib7000m_demod_reset(struct dib7000m_state *state)
|
||||
dib7000mc_reset_pll(state);
|
||||
|
||||
if (dib7000m_reset_gpio(state) != 0)
|
||||
dprintk( "GPIO reset was not successful.");
|
||||
dprintk("GPIO reset was not successful.\n");
|
||||
|
||||
if (dib7000m_set_output_mode(state, OUTMODE_HIGH_Z) != 0)
|
||||
dprintk( "OUTPUT_MODE could not be reset.");
|
||||
dprintk("OUTPUT_MODE could not be reset.\n");
|
||||
|
||||
/* unforce divstr regardless whether i2c enumeration was done or not */
|
||||
dib7000m_write_word(state, 1794, dib7000m_read_word(state, 1794) & ~(1 << 1) );
|
||||
@@ -650,7 +657,7 @@ static int dib7000m_agc_soft_split(struct dib7000m_state *state)
|
||||
(agc - state->current_agc->split.min_thres) /
|
||||
(state->current_agc->split.max_thres - state->current_agc->split.min_thres);
|
||||
|
||||
dprintk( "AGC split_offset: %d",split_offset);
|
||||
dprintk("AGC split_offset: %d\n", split_offset);
|
||||
|
||||
// P_agc_force_split and P_agc_split_offset
|
||||
return dib7000m_write_word(state, 103, (dib7000m_read_word(state, 103) & 0xff00) | split_offset);
|
||||
@@ -687,7 +694,7 @@ static int dib7000m_set_agc_config(struct dib7000m_state *state, u8 band)
|
||||
}
|
||||
|
||||
if (agc == NULL) {
|
||||
dprintk( "no valid AGC configuration found for band 0x%02x",band);
|
||||
dprintk("no valid AGC configuration found for band 0x%02x\n", band);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -703,7 +710,7 @@ static int dib7000m_set_agc_config(struct dib7000m_state *state, u8 band)
|
||||
dib7000m_write_word(state, 98, (agc->alpha_mant << 5) | agc->alpha_exp);
|
||||
dib7000m_write_word(state, 99, (agc->beta_mant << 6) | agc->beta_exp);
|
||||
|
||||
dprintk( "WBD: ref: %d, sel: %d, active: %d, alpha: %d",
|
||||
dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d\n",
|
||||
state->wbd_ref != 0 ? state->wbd_ref : agc->wbd_ref, agc->wbd_sel, !agc->perform_agc_softsplit, agc->wbd_sel);
|
||||
|
||||
/* AGC continued */
|
||||
@@ -724,7 +731,7 @@ static int dib7000m_set_agc_config(struct dib7000m_state *state, u8 band)
|
||||
|
||||
if (state->revision > 0x4000) { // settings for the MC
|
||||
dib7000m_write_word(state, 71, agc->agc1_pt3);
|
||||
// dprintk( "929: %x %d %d",
|
||||
// dprintk("929: %x %d %d\n",
|
||||
// (dib7000m_read_word(state, 929) & 0xffe3) | (agc->wbd_inv << 4) | (agc->wbd_sel << 2), agc->wbd_inv, agc->wbd_sel);
|
||||
dib7000m_write_word(state, 929, (dib7000m_read_word(state, 929) & 0xffe3) | (agc->wbd_inv << 4) | (agc->wbd_sel << 2));
|
||||
} else {
|
||||
@@ -742,7 +749,7 @@ static void dib7000m_update_timf(struct dib7000m_state *state)
|
||||
state->timf = timf * 160 / (state->current_bandwidth / 50);
|
||||
dib7000m_write_word(state, 23, (u16) (timf >> 16));
|
||||
dib7000m_write_word(state, 24, (u16) (timf & 0xffff));
|
||||
dprintk( "updated timf_frequency: %d (default: %d)",state->timf, state->timf_default);
|
||||
dprintk("updated timf_frequency: %d (default: %d)\n", state->timf, state->timf_default);
|
||||
}
|
||||
|
||||
static int dib7000m_agc_startup(struct dvb_frontend *demod)
|
||||
@@ -804,7 +811,7 @@ static int dib7000m_agc_startup(struct dvb_frontend *demod)
|
||||
|
||||
dib7000m_restart_agc(state);
|
||||
|
||||
dprintk( "SPLIT %p: %hd", demod, agc_split);
|
||||
dprintk("SPLIT %p: %hd\n", demod, agc_split);
|
||||
|
||||
(*agc_state)++;
|
||||
ret = 5;
|
||||
@@ -1013,12 +1020,12 @@ static int dib7000m_autosearch_irq(struct dib7000m_state *state, u16 reg)
|
||||
u16 irq_pending = dib7000m_read_word(state, reg);
|
||||
|
||||
if (irq_pending & 0x1) { // failed
|
||||
dprintk( "autosearch failed");
|
||||
dprintk("autosearch failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (irq_pending & 0x2) { // succeeded
|
||||
dprintk( "autosearch succeeded");
|
||||
dprintk("autosearch succeeded\n");
|
||||
return 2;
|
||||
}
|
||||
return 0; // still pending
|
||||
@@ -1102,7 +1109,7 @@ static int dib7000m_wakeup(struct dvb_frontend *demod)
|
||||
dib7000m_set_power_mode(state, DIB7000M_POWER_ALL);
|
||||
|
||||
if (dib7000m_set_adc_state(state, DIBX000_SLOW_ADC_ON) != 0)
|
||||
dprintk( "could not start Slow ADC");
|
||||
dprintk("could not start Slow ADC\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1121,7 +1128,7 @@ static int dib7000m_identify(struct dib7000m_state *state)
|
||||
u16 value;
|
||||
|
||||
if ((value = dib7000m_read_word(state, 896)) != 0x01b3) {
|
||||
dprintk( "wrong Vendor ID (0x%x)",value);
|
||||
dprintk("wrong Vendor ID (0x%x)\n", value);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
@@ -1130,21 +1137,21 @@ static int dib7000m_identify(struct dib7000m_state *state)
|
||||
state->revision != 0x4001 &&
|
||||
state->revision != 0x4002 &&
|
||||
state->revision != 0x4003) {
|
||||
dprintk( "wrong Device ID (0x%x)",value);
|
||||
dprintk("wrong Device ID (0x%x)\n", value);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
/* protect this driver to be used with 7000PC */
|
||||
if (state->revision == 0x4000 && dib7000m_read_word(state, 769) == 0x4000) {
|
||||
dprintk( "this driver does not work with DiB7000PC");
|
||||
dprintk("this driver does not work with DiB7000PC\n");
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
switch (state->revision) {
|
||||
case 0x4000: dprintk( "found DiB7000MA/PA/MB/PB"); break;
|
||||
case 0x4001: state->reg_offs = 1; dprintk( "found DiB7000HC"); break;
|
||||
case 0x4002: state->reg_offs = 1; dprintk( "found DiB7000MC"); break;
|
||||
case 0x4003: state->reg_offs = 1; dprintk( "found DiB9000"); break;
|
||||
case 0x4000: dprintk("found DiB7000MA/PA/MB/PB\n"); break;
|
||||
case 0x4001: state->reg_offs = 1; dprintk("found DiB7000HC\n"); break;
|
||||
case 0x4002: state->reg_offs = 1; dprintk("found DiB7000MC\n"); break;
|
||||
case 0x4003: state->reg_offs = 1; dprintk("found DiB9000\n"); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1242,7 +1249,7 @@ static int dib7000m_set_frontend(struct dvb_frontend *fe)
|
||||
found = dib7000m_autosearch_is_irq(fe);
|
||||
} while (found == 0 && i--);
|
||||
|
||||
dprintk("autosearch returns: %d",found);
|
||||
dprintk("autosearch returns: %d\n", found);
|
||||
if (found == 0 || found == 1)
|
||||
return 0; // no channel found
|
||||
|
||||
@@ -1330,7 +1337,7 @@ int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
|
||||
struct dib7000m_state *state = fe->demodulator_priv;
|
||||
u16 val = dib7000m_read_word(state, 294 + state->reg_offs) & 0xffef;
|
||||
val |= (onoff & 0x1) << 4;
|
||||
dprintk("PID filter enabled %d", onoff);
|
||||
dprintk("PID filter enabled %d\n", onoff);
|
||||
return dib7000m_write_word(state, 294 + state->reg_offs, val);
|
||||
}
|
||||
EXPORT_SYMBOL(dib7000m_pid_filter_ctrl);
|
||||
@@ -1338,7 +1345,7 @@ EXPORT_SYMBOL(dib7000m_pid_filter_ctrl);
|
||||
int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
|
||||
{
|
||||
struct dib7000m_state *state = fe->demodulator_priv;
|
||||
dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff);
|
||||
dprintk("PID filter: index %x, PID %d, OnOff %d\n", id, pid, onoff);
|
||||
return dib7000m_write_word(state, 300 + state->reg_offs + id,
|
||||
onoff ? (1 << 13) | pid : 0);
|
||||
}
|
||||
@@ -1362,7 +1369,7 @@ int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods,
|
||||
if (dib7000m_identify(&st) != 0) {
|
||||
st.i2c_addr = default_addr;
|
||||
if (dib7000m_identify(&st) != 0) {
|
||||
dprintk("DiB7000M #%d: not identified", k);
|
||||
dprintk("DiB7000M #%d: not identified\n", k);
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
@@ -1375,7 +1382,7 @@ int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods,
|
||||
/* set new i2c address and force divstart */
|
||||
dib7000m_write_word(&st, 1794, (new_addr << 2) | 0x2);
|
||||
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr);
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr);
|
||||
}
|
||||
|
||||
for (k = 0; k < no_of_demods; k++) {
|
||||
@@ -1394,7 +1401,7 @@ int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods,
|
||||
EXPORT_SYMBOL(dib7000m_i2c_enumeration);
|
||||
#endif
|
||||
|
||||
static struct dvb_frontend_ops dib7000m_ops;
|
||||
static const struct dvb_frontend_ops dib7000m_ops;
|
||||
struct dvb_frontend * dib7000m_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000m_config *cfg)
|
||||
{
|
||||
struct dvb_frontend *demod;
|
||||
@@ -1432,7 +1439,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(dib7000m_attach);
|
||||
|
||||
static struct dvb_frontend_ops dib7000m_ops = {
|
||||
static const struct dvb_frontend_ops dib7000m_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "DiBcom 7000MA/MB/PA/PB/MC",
|
||||
|
@@ -7,6 +7,9 @@
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, version 2.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -26,7 +29,11 @@ static int buggy_sfn_workaround;
|
||||
module_param(buggy_sfn_workaround, int, 0644);
|
||||
MODULE_PARM_DESC(buggy_sfn_workaround, "Enable work-around for buggy SFNs (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB7000P: "); printk(args); printk("\n"); } } while (0)
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
struct i2c_device {
|
||||
struct i2c_adapter *i2c_adap;
|
||||
@@ -98,7 +105,7 @@ static u16 dib7000p_read_word(struct dib7000p_state *state, u16 reg)
|
||||
u16 ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -116,7 +123,7 @@ static u16 dib7000p_read_word(struct dib7000p_state *state, u16 reg)
|
||||
state->msg[1].len = 2;
|
||||
|
||||
if (i2c_transfer(state->i2c_adap, state->msg, 2) != 2)
|
||||
dprintk("i2c read error on %d", reg);
|
||||
dprintk("i2c read error on %d\n", reg);
|
||||
|
||||
ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1];
|
||||
mutex_unlock(&state->i2c_buffer_lock);
|
||||
@@ -128,7 +135,7 @@ static int dib7000p_write_word(struct dib7000p_state *state, u16 reg, u16 val)
|
||||
int ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -174,7 +181,7 @@ static int dib7000p_set_output_mode(struct dib7000p_state *state, int mode)
|
||||
fifo_threshold = 1792;
|
||||
smo_mode = (dib7000p_read_word(state, 235) & 0x0050) | (1 << 1);
|
||||
|
||||
dprintk("setting output mode for demod %p to %d", &state->demod, mode);
|
||||
dprintk("setting output mode for demod %p to %d\n", &state->demod, mode);
|
||||
|
||||
switch (mode) {
|
||||
case OUTMODE_MPEG2_PAR_GATED_CLK:
|
||||
@@ -204,7 +211,7 @@ static int dib7000p_set_output_mode(struct dib7000p_state *state, int mode)
|
||||
outreg = 0;
|
||||
break;
|
||||
default:
|
||||
dprintk("Unhandled output_mode passed to be set for demod %p", &state->demod);
|
||||
dprintk("Unhandled output_mode passed to be set for demod %p\n", &state->demod);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -224,7 +231,7 @@ static int dib7000p_set_diversity_in(struct dvb_frontend *demod, int onoff)
|
||||
struct dib7000p_state *state = demod->demodulator_priv;
|
||||
|
||||
if (state->div_force_off) {
|
||||
dprintk("diversity combination deactivated - forced by COFDM parameters");
|
||||
dprintk("diversity combination deactivated - forced by COFDM parameters\n");
|
||||
onoff = 0;
|
||||
dib7000p_write_word(state, 207, 0);
|
||||
} else
|
||||
@@ -374,10 +381,10 @@ static int dib7000p_set_bandwidth(struct dib7000p_state *state, u32 bw)
|
||||
state->current_bandwidth = bw;
|
||||
|
||||
if (state->timf == 0) {
|
||||
dprintk("using default timf");
|
||||
dprintk("using default timf\n");
|
||||
timf = state->cfg.bw->timf;
|
||||
} else {
|
||||
dprintk("using updated timf");
|
||||
dprintk("using updated timf\n");
|
||||
timf = state->timf;
|
||||
}
|
||||
|
||||
@@ -494,7 +501,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth
|
||||
loopdiv = (reg_1856 >> 6) & 0x3f;
|
||||
|
||||
if ((bw != NULL) && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) {
|
||||
dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)", prediv, bw->pll_prediv, loopdiv, bw->pll_ratio);
|
||||
dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)\n", prediv, bw->pll_prediv, loopdiv, bw->pll_ratio);
|
||||
reg_1856 &= 0xf000;
|
||||
reg_1857 = dib7000p_read_word(state, 1857);
|
||||
dib7000p_write_word(state, 1857, reg_1857 & ~(1 << 15));
|
||||
@@ -511,7 +518,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth
|
||||
dib7000p_write_word(state, 1857, reg_1857 | (1 << 15));
|
||||
|
||||
while (((dib7000p_read_word(state, 1856) >> 15) & 0x1) != 1)
|
||||
dprintk("Waiting for PLL to lock");
|
||||
dprintk("Waiting for PLL to lock\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -521,7 +528,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth
|
||||
static int dib7000p_reset_gpio(struct dib7000p_state *st)
|
||||
{
|
||||
/* reset the GPIOs */
|
||||
dprintk("gpio dir: %x: val: %x, pwm_pos: %x", st->gpio_dir, st->gpio_val, st->cfg.gpio_pwm_pos);
|
||||
dprintk("gpio dir: %x: val: %x, pwm_pos: %x\n", st->gpio_dir, st->gpio_val, st->cfg.gpio_pwm_pos);
|
||||
|
||||
dib7000p_write_word(st, 1029, st->gpio_dir);
|
||||
dib7000p_write_word(st, 1030, st->gpio_val);
|
||||
@@ -669,7 +676,7 @@ static int dib7000p_demod_reset(struct dib7000p_state *state)
|
||||
dib7000p_reset_pll(state);
|
||||
|
||||
if (dib7000p_reset_gpio(state) != 0)
|
||||
dprintk("GPIO reset was not successful.");
|
||||
dprintk("GPIO reset was not successful.\n");
|
||||
|
||||
if (state->version == SOC7090) {
|
||||
dib7000p_write_word(state, 899, 0);
|
||||
@@ -681,7 +688,7 @@ static int dib7000p_demod_reset(struct dib7000p_state *state)
|
||||
dib7000p_write_word(state, 273, (0<<6) | 30);
|
||||
}
|
||||
if (dib7000p_set_output_mode(state, OUTMODE_HIGH_Z) != 0)
|
||||
dprintk("OUTPUT_MODE could not be reset.");
|
||||
dprintk("OUTPUT_MODE could not be reset.\n");
|
||||
|
||||
dib7000p_set_adc_state(state, DIBX000_SLOW_ADC_ON);
|
||||
dib7000p_sad_calib(state);
|
||||
@@ -759,7 +766,7 @@ static int dib7000p_set_agc_config(struct dib7000p_state *state, u8 band)
|
||||
}
|
||||
|
||||
if (agc == NULL) {
|
||||
dprintk("no valid AGC configuration found for band 0x%02x", band);
|
||||
dprintk("no valid AGC configuration found for band 0x%02x\n", band);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -776,7 +783,7 @@ static int dib7000p_set_agc_config(struct dib7000p_state *state, u8 band)
|
||||
dib7000p_write_word(state, 102, (agc->beta_mant << 6) | agc->beta_exp);
|
||||
|
||||
/* AGC continued */
|
||||
dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d",
|
||||
dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d\n",
|
||||
state->wbd_ref != 0 ? state->wbd_ref : agc->wbd_ref, agc->wbd_sel, !agc->perform_agc_softsplit, agc->wbd_sel);
|
||||
|
||||
if (state->wbd_ref != 0)
|
||||
@@ -806,7 +813,7 @@ static void dib7000p_set_dds(struct dib7000p_state *state, s32 offset_khz)
|
||||
u32 dds = state->cfg.bw->ifreq & 0x1ffffff;
|
||||
u8 invert = !!(state->cfg.bw->ifreq & (1 << 25));
|
||||
|
||||
dprintk("setting a frequency offset of %dkHz internal freq = %d invert = %d", offset_khz, internal, invert);
|
||||
dprintk("setting a frequency offset of %dkHz internal freq = %d invert = %d\n", offset_khz, internal, invert);
|
||||
|
||||
if (offset_khz < 0)
|
||||
unit_khz_dds_val *= -1;
|
||||
@@ -902,7 +909,7 @@ static int dib7000p_agc_startup(struct dvb_frontend *demod)
|
||||
|
||||
dib7000p_restart_agc(state);
|
||||
|
||||
dprintk("SPLIT %p: %hd", demod, agc_split);
|
||||
dprintk("SPLIT %p: %hd\n", demod, agc_split);
|
||||
|
||||
(*agc_state)++;
|
||||
ret = 5;
|
||||
@@ -934,7 +941,7 @@ static void dib7000p_update_timf(struct dib7000p_state *state)
|
||||
state->timf = timf * 160 / (state->current_bandwidth / 50);
|
||||
dib7000p_write_word(state, 23, (u16) (timf >> 16));
|
||||
dib7000p_write_word(state, 24, (u16) (timf & 0xffff));
|
||||
dprintk("updated timf_frequency: %d (default: %d)", state->timf, state->cfg.bw->timf);
|
||||
dprintk("updated timf_frequency: %d (default: %d)\n", state->timf, state->cfg.bw->timf);
|
||||
|
||||
}
|
||||
|
||||
@@ -1202,7 +1209,7 @@ static void dib7000p_spur_protect(struct dib7000p_state *state, u32 rf_khz, u32
|
||||
int bw_khz = bw;
|
||||
u32 pha;
|
||||
|
||||
dprintk("relative position of the Spur: %dk (RF: %dk, XTAL: %dk)", f_rel, rf_khz, xtal);
|
||||
dprintk("relative position of the Spur: %dk (RF: %dk, XTAL: %dk)\n", f_rel, rf_khz, xtal);
|
||||
|
||||
if (f_rel < -bw_khz / 2 || f_rel > bw_khz / 2)
|
||||
return;
|
||||
@@ -1252,7 +1259,7 @@ static void dib7000p_spur_protect(struct dib7000p_state *state, u32 rf_khz, u32
|
||||
coef_im[k] = (1 << 24) - 1;
|
||||
coef_im[k] /= (1 << 15);
|
||||
|
||||
dprintk("PALF COEF: %d re: %d im: %d", k, coef_re[k], coef_im[k]);
|
||||
dprintk("PALF COEF: %d re: %d im: %d\n", k, coef_re[k], coef_im[k]);
|
||||
|
||||
dib7000p_write_word(state, 143, (0 << 14) | (k << 10) | (coef_re[k] & 0x3ff));
|
||||
dib7000p_write_word(state, 144, coef_im[k] & 0x3ff);
|
||||
@@ -1280,7 +1287,7 @@ static int dib7000p_tune(struct dvb_frontend *demod)
|
||||
/* P_ctrl_inh_cor=0, P_ctrl_alpha_cor=4, P_ctrl_inh_isi=0, P_ctrl_alpha_isi=3, P_ctrl_inh_cor4=1, P_ctrl_alpha_cor4=3 */
|
||||
tmp = (0 << 14) | (4 << 10) | (0 << 9) | (3 << 5) | (1 << 4) | (0x3);
|
||||
if (state->sfn_workaround_active) {
|
||||
dprintk("SFN workaround is active");
|
||||
dprintk("SFN workaround is active\n");
|
||||
tmp |= (1 << 9);
|
||||
dib7000p_write_word(state, 166, 0x4000);
|
||||
} else {
|
||||
@@ -1390,15 +1397,15 @@ static int dib7000p_sleep(struct dvb_frontend *demod)
|
||||
static int dib7000p_identify(struct dib7000p_state *st)
|
||||
{
|
||||
u16 value;
|
||||
dprintk("checking demod on I2C address: %d (%x)", st->i2c_addr, st->i2c_addr);
|
||||
dprintk("checking demod on I2C address: %d (%x)\n", st->i2c_addr, st->i2c_addr);
|
||||
|
||||
if ((value = dib7000p_read_word(st, 768)) != 0x01b3) {
|
||||
dprintk("wrong Vendor ID (read=0x%x)", value);
|
||||
dprintk("wrong Vendor ID (read=0x%x)\n", value);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
if ((value = dib7000p_read_word(st, 769)) != 0x4000) {
|
||||
dprintk("wrong Device ID (%x)", value);
|
||||
dprintk("wrong Device ID (%x)\n", value);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
@@ -1536,7 +1543,7 @@ static int dib7000p_set_frontend(struct dvb_frontend *fe)
|
||||
found = dib7000p_autosearch_is_irq(fe);
|
||||
} while (found == 0 && i--);
|
||||
|
||||
dprintk("autosearch returns: %d", found);
|
||||
dprintk("autosearch returns: %d\n", found);
|
||||
if (found == 0 || found == 1)
|
||||
return 0;
|
||||
|
||||
@@ -1951,7 +1958,7 @@ static int dib7000p_get_stats(struct dvb_frontend *demod, enum fe_status stat)
|
||||
time_us = dib7000p_get_time_us(demod);
|
||||
state->ber_jiffies_stats = jiffies + msecs_to_jiffies((time_us + 500) / 1000);
|
||||
|
||||
dprintk("Next all layers stats available in %u us.", time_us);
|
||||
dprintk("Next all layers stats available in %u us.\n", time_us);
|
||||
|
||||
dib7000p_read_ber(demod, &val);
|
||||
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
|
||||
@@ -2019,7 +2026,7 @@ static int dib7000pc_detection(struct i2c_adapter *i2c_adap)
|
||||
|
||||
if (i2c_transfer(i2c_adap, msg, 2) == 2)
|
||||
if (rx[0] == 0x01 && rx[1] == 0xb3) {
|
||||
dprintk("-D- DiB7000PC detected");
|
||||
dprintk("-D- DiB7000PC detected\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2027,11 +2034,11 @@ static int dib7000pc_detection(struct i2c_adapter *i2c_adap)
|
||||
|
||||
if (i2c_transfer(i2c_adap, msg, 2) == 2)
|
||||
if (rx[0] == 0x01 && rx[1] == 0xb3) {
|
||||
dprintk("-D- DiB7000PC detected");
|
||||
dprintk("-D- DiB7000PC detected\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
dprintk("-D- DiB7000PC not detected");
|
||||
dprintk("-D- DiB7000PC not detected\n");
|
||||
|
||||
kfree(rx);
|
||||
rx_memory_error:
|
||||
@@ -2050,14 +2057,14 @@ static int dib7000p_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
|
||||
struct dib7000p_state *state = fe->demodulator_priv;
|
||||
u16 val = dib7000p_read_word(state, 235) & 0xffef;
|
||||
val |= (onoff & 0x1) << 4;
|
||||
dprintk("PID filter enabled %d", onoff);
|
||||
dprintk("PID filter enabled %d\n", onoff);
|
||||
return dib7000p_write_word(state, 235, val);
|
||||
}
|
||||
|
||||
static int dib7000p_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
|
||||
{
|
||||
struct dib7000p_state *state = fe->demodulator_priv;
|
||||
dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff);
|
||||
dprintk("PID filter: index %x, PID %d, OnOff %d\n", id, pid, onoff);
|
||||
return dib7000p_write_word(state, 241 + id, onoff ? (1 << 13) | pid : 0);
|
||||
}
|
||||
|
||||
@@ -2100,7 +2107,7 @@ static int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u
|
||||
/* set new i2c address and force divstart */
|
||||
dib7000p_write_word(dpst, 1285, (new_addr << 2) | 0x2);
|
||||
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr);
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr);
|
||||
}
|
||||
|
||||
for (k = 0; k < no_of_demods; k++) {
|
||||
@@ -2136,21 +2143,21 @@ static s32 dib7000p_get_adc_power(struct dvb_frontend *fe)
|
||||
buf[0] = dib7000p_read_word(state, 0x184);
|
||||
buf[1] = dib7000p_read_word(state, 0x185);
|
||||
pow_i = (buf[0] << 16) | buf[1];
|
||||
dprintk("raw pow_i = %d", pow_i);
|
||||
dprintk("raw pow_i = %d\n", pow_i);
|
||||
|
||||
tmp_val = pow_i;
|
||||
while (tmp_val >>= 1)
|
||||
exp++;
|
||||
|
||||
mant = (pow_i * 1000 / (1 << exp));
|
||||
dprintk(" mant = %d exp = %d", mant / 1000, exp);
|
||||
dprintk(" mant = %d exp = %d\n", mant / 1000, exp);
|
||||
|
||||
ix = (u8) ((mant - 1000) / 100); /* index of the LUT */
|
||||
dprintk(" ix = %d", ix);
|
||||
dprintk(" ix = %d\n", ix);
|
||||
|
||||
pow_i = (lut_1000ln_mant[ix] + 693 * (exp - 20) - 6908);
|
||||
pow_i = (pow_i << 8) / 1000;
|
||||
dprintk(" pow_i = %d", pow_i);
|
||||
dprintk(" pow_i = %d\n", pow_i);
|
||||
|
||||
return pow_i;
|
||||
}
|
||||
@@ -2185,7 +2192,7 @@ static int w7090p_tuner_write_serpar(struct i2c_adapter *i2c_adap, struct i2c_ms
|
||||
n_overflow = (dib7000p_read_word(state, 1984) >> 1) & 0x1;
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("Tuner ITF: write busy (overflow)");
|
||||
dprintk("Tuner ITF: write busy (overflow)\n");
|
||||
}
|
||||
dib7000p_write_word(state, 1985, (1 << 6) | (serpar_num & 0x3f));
|
||||
dib7000p_write_word(state, 1986, (msg[0].buf[1] << 8) | msg[0].buf[2]);
|
||||
@@ -2205,7 +2212,7 @@ static int w7090p_tuner_read_serpar(struct i2c_adapter *i2c_adap, struct i2c_msg
|
||||
n_overflow = (dib7000p_read_word(state, 1984) >> 1) & 0x1;
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("TunerITF: read busy (overflow)");
|
||||
dprintk("TunerITF: read busy (overflow)\n");
|
||||
}
|
||||
dib7000p_write_word(state, 1985, (0 << 6) | (serpar_num & 0x3f));
|
||||
|
||||
@@ -2214,7 +2221,7 @@ static int w7090p_tuner_read_serpar(struct i2c_adapter *i2c_adap, struct i2c_msg
|
||||
n_empty = dib7000p_read_word(state, 1984) & 0x1;
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("TunerITF: read busy (empty)");
|
||||
dprintk("TunerITF: read busy (empty)\n");
|
||||
}
|
||||
read_word = dib7000p_read_word(state, 1987);
|
||||
msg[1].buf[0] = (read_word >> 8) & 0xff;
|
||||
@@ -2435,7 +2442,7 @@ static u32 dib7090_calcSyncFreq(u32 P_Kin, u32 P_Kout, u32 insertExtSynchro, u32
|
||||
|
||||
static int dib7090_cfg_DibTx(struct dib7000p_state *state, u32 P_Kin, u32 P_Kout, u32 insertExtSynchro, u32 synchroMode, u32 syncWord, u32 syncSize)
|
||||
{
|
||||
dprintk("Configure DibStream Tx");
|
||||
dprintk("Configure DibStream Tx\n");
|
||||
|
||||
dib7000p_write_word(state, 1615, 1);
|
||||
dib7000p_write_word(state, 1603, P_Kin);
|
||||
@@ -2455,7 +2462,7 @@ static int dib7090_cfg_DibRx(struct dib7000p_state *state, u32 P_Kin, u32 P_Kout
|
||||
{
|
||||
u32 syncFreq;
|
||||
|
||||
dprintk("Configure DibStream Rx");
|
||||
dprintk("Configure DibStream Rx\n");
|
||||
if ((P_Kin != 0) && (P_Kout != 0)) {
|
||||
syncFreq = dib7090_calcSyncFreq(P_Kin, P_Kout, insertExtSynchro, syncSize);
|
||||
dib7000p_write_word(state, 1542, syncFreq);
|
||||
@@ -2492,7 +2499,7 @@ static void dib7090_enMpegMux(struct dib7000p_state *state, int onoff)
|
||||
static void dib7090_configMpegMux(struct dib7000p_state *state,
|
||||
u16 pulseWidth, u16 enSerialMode, u16 enSerialClkDiv2)
|
||||
{
|
||||
dprintk("Enable Mpeg mux");
|
||||
dprintk("Enable Mpeg mux\n");
|
||||
|
||||
dib7090_enMpegMux(state, 0);
|
||||
|
||||
@@ -2513,17 +2520,17 @@ static void dib7090_setDibTxMux(struct dib7000p_state *state, int mode)
|
||||
|
||||
switch (mode) {
|
||||
case MPEG_ON_DIBTX:
|
||||
dprintk("SET MPEG ON DIBSTREAM TX");
|
||||
dprintk("SET MPEG ON DIBSTREAM TX\n");
|
||||
dib7090_cfg_DibTx(state, 8, 5, 0, 0, 0, 0);
|
||||
reg_1288 |= (1<<9);
|
||||
break;
|
||||
case DIV_ON_DIBTX:
|
||||
dprintk("SET DIV_OUT ON DIBSTREAM TX");
|
||||
dprintk("SET DIV_OUT ON DIBSTREAM TX\n");
|
||||
dib7090_cfg_DibTx(state, 5, 5, 0, 0, 0, 0);
|
||||
reg_1288 |= (1<<8);
|
||||
break;
|
||||
case ADC_ON_DIBTX:
|
||||
dprintk("SET ADC_OUT ON DIBSTREAM TX");
|
||||
dprintk("SET ADC_OUT ON DIBSTREAM TX\n");
|
||||
dib7090_cfg_DibTx(state, 20, 5, 10, 0, 0, 0);
|
||||
reg_1288 |= (1<<7);
|
||||
break;
|
||||
@@ -2539,17 +2546,17 @@ static void dib7090_setHostBusMux(struct dib7000p_state *state, int mode)
|
||||
|
||||
switch (mode) {
|
||||
case DEMOUT_ON_HOSTBUS:
|
||||
dprintk("SET DEM OUT OLD INTERF ON HOST BUS");
|
||||
dprintk("SET DEM OUT OLD INTERF ON HOST BUS\n");
|
||||
dib7090_enMpegMux(state, 0);
|
||||
reg_1288 |= (1<<6);
|
||||
break;
|
||||
case DIBTX_ON_HOSTBUS:
|
||||
dprintk("SET DIBSTREAM TX ON HOST BUS");
|
||||
dprintk("SET DIBSTREAM TX ON HOST BUS\n");
|
||||
dib7090_enMpegMux(state, 0);
|
||||
reg_1288 |= (1<<5);
|
||||
break;
|
||||
case MPEG_ON_HOSTBUS:
|
||||
dprintk("SET MPEG MUX ON HOST BUS");
|
||||
dprintk("SET MPEG MUX ON HOST BUS\n");
|
||||
reg_1288 |= (1<<4);
|
||||
break;
|
||||
default:
|
||||
@@ -2565,7 +2572,7 @@ static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff)
|
||||
|
||||
switch (onoff) {
|
||||
case 0: /* only use the internal way - not the diversity input */
|
||||
dprintk("%s mode OFF : by default Enable Mpeg INPUT", __func__);
|
||||
dprintk("%s mode OFF : by default Enable Mpeg INPUT\n", __func__);
|
||||
dib7090_cfg_DibRx(state, 8, 5, 0, 0, 0, 8, 0);
|
||||
|
||||
/* Do not divide the serial clock of MPEG MUX */
|
||||
@@ -2581,7 +2588,7 @@ static int dib7090_set_diversity_in(struct dvb_frontend *fe, int onoff)
|
||||
break;
|
||||
case 1: /* both ways */
|
||||
case 2: /* only the diversity input */
|
||||
dprintk("%s ON : Enable diversity INPUT", __func__);
|
||||
dprintk("%s ON : Enable diversity INPUT\n", __func__);
|
||||
dib7090_cfg_DibRx(state, 5, 5, 0, 0, 0, 0, 0);
|
||||
state->input_mode_mpeg = 0;
|
||||
break;
|
||||
@@ -2612,11 +2619,11 @@ static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
|
||||
case OUTMODE_MPEG2_SERIAL:
|
||||
if (prefer_mpeg_mux_use) {
|
||||
dprintk("setting output mode TS_SERIAL using Mpeg Mux");
|
||||
dprintk("setting output mode TS_SERIAL using Mpeg Mux\n");
|
||||
dib7090_configMpegMux(state, 3, 1, 1);
|
||||
dib7090_setHostBusMux(state, MPEG_ON_HOSTBUS);
|
||||
} else {/* Use Smooth block */
|
||||
dprintk("setting output mode TS_SERIAL using Smooth bloc");
|
||||
dprintk("setting output mode TS_SERIAL using Smooth bloc\n");
|
||||
dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (2<<6) | (0 << 1);
|
||||
}
|
||||
@@ -2624,24 +2631,24 @@ static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
|
||||
case OUTMODE_MPEG2_PAR_GATED_CLK:
|
||||
if (prefer_mpeg_mux_use) {
|
||||
dprintk("setting output mode TS_PARALLEL_GATED using Mpeg Mux");
|
||||
dprintk("setting output mode TS_PARALLEL_GATED using Mpeg Mux\n");
|
||||
dib7090_configMpegMux(state, 2, 0, 0);
|
||||
dib7090_setHostBusMux(state, MPEG_ON_HOSTBUS);
|
||||
} else { /* Use Smooth block */
|
||||
dprintk("setting output mode TS_PARALLEL_GATED using Smooth block");
|
||||
dprintk("setting output mode TS_PARALLEL_GATED using Smooth block\n");
|
||||
dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (0<<6);
|
||||
}
|
||||
break;
|
||||
|
||||
case OUTMODE_MPEG2_PAR_CONT_CLK: /* Using Smooth block only */
|
||||
dprintk("setting output mode TS_PARALLEL_CONT using Smooth block");
|
||||
dprintk("setting output mode TS_PARALLEL_CONT using Smooth block\n");
|
||||
dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (1<<6);
|
||||
break;
|
||||
|
||||
case OUTMODE_MPEG2_FIFO: /* Using Smooth block because not supported by new Mpeg Mux bloc */
|
||||
dprintk("setting output mode TS_FIFO using Smooth block");
|
||||
dprintk("setting output mode TS_FIFO using Smooth block\n");
|
||||
dib7090_setHostBusMux(state, DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (5<<6);
|
||||
smo_mode |= (3 << 1);
|
||||
@@ -2649,13 +2656,13 @@ static int dib7090_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
break;
|
||||
|
||||
case OUTMODE_DIVERSITY:
|
||||
dprintk("setting output mode MODE_DIVERSITY");
|
||||
dprintk("setting output mode MODE_DIVERSITY\n");
|
||||
dib7090_setDibTxMux(state, DIV_ON_DIBTX);
|
||||
dib7090_setHostBusMux(state, DIBTX_ON_HOSTBUS);
|
||||
break;
|
||||
|
||||
case OUTMODE_ANALOG_ADC:
|
||||
dprintk("setting output mode MODE_ANALOG_ADC");
|
||||
dprintk("setting output mode MODE_ANALOG_ADC\n");
|
||||
dib7090_setDibTxMux(state, ADC_ON_DIBTX);
|
||||
dib7090_setHostBusMux(state, DIBTX_ON_HOSTBUS);
|
||||
break;
|
||||
@@ -2678,7 +2685,7 @@ static int dib7090_tuner_sleep(struct dvb_frontend *fe, int onoff)
|
||||
struct dib7000p_state *state = fe->demodulator_priv;
|
||||
u16 en_cur_state;
|
||||
|
||||
dprintk("sleep dib7090: %d", onoff);
|
||||
dprintk("sleep dib7090: %d\n", onoff);
|
||||
|
||||
en_cur_state = dib7000p_read_word(state, 1922);
|
||||
|
||||
@@ -2714,7 +2721,7 @@ static int dib7090_slave_reset(struct dvb_frontend *fe)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops dib7000p_ops;
|
||||
static const struct dvb_frontend_ops dib7000p_ops;
|
||||
static struct dvb_frontend *dib7000p_init(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg)
|
||||
{
|
||||
struct dvb_frontend *demod;
|
||||
@@ -2804,7 +2811,7 @@ void *dib7000p_attach(struct dib7000p_ops *ops)
|
||||
}
|
||||
EXPORT_SYMBOL(dib7000p_attach);
|
||||
|
||||
static struct dvb_frontend_ops dib7000p_ops = {
|
||||
static const struct dvb_frontend_ops dib7000p_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "DiBcom 7000PC",
|
||||
|
@@ -7,6 +7,9 @@
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, version 2.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -31,7 +34,11 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB8000: "); printk(args); printk("\n"); } } while (0)
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
struct i2c_device {
|
||||
struct i2c_adapter *adap;
|
||||
@@ -147,7 +154,7 @@ static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg)
|
||||
};
|
||||
|
||||
if (mutex_lock_interruptible(i2c->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -157,7 +164,7 @@ static u16 dib8000_i2c_read16(struct i2c_device *i2c, u16 reg)
|
||||
msg[1].buf = i2c->i2c_read_buffer;
|
||||
|
||||
if (i2c_transfer(i2c->adap, msg, 2) != 2)
|
||||
dprintk("i2c read error on %d", reg);
|
||||
dprintk("i2c read error on %d\n", reg);
|
||||
|
||||
ret = (msg[1].buf[0] << 8) | msg[1].buf[1];
|
||||
mutex_unlock(i2c->i2c_buffer_lock);
|
||||
@@ -182,7 +189,7 @@ static u16 __dib8000_read_word(struct dib8000_state *state, u16 reg)
|
||||
state->msg[1].len = 2;
|
||||
|
||||
if (i2c_transfer(state->i2c.adap, state->msg, 2) != 2)
|
||||
dprintk("i2c read error on %d", reg);
|
||||
dprintk("i2c read error on %d\n", reg);
|
||||
|
||||
ret = (state->i2c_read_buffer[0] << 8) | state->i2c_read_buffer[1];
|
||||
|
||||
@@ -194,7 +201,7 @@ static u16 dib8000_read_word(struct dib8000_state *state, u16 reg)
|
||||
u16 ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -210,7 +217,7 @@ static u32 dib8000_read32(struct dib8000_state *state, u16 reg)
|
||||
u16 rw[2];
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -228,7 +235,7 @@ static int dib8000_i2c_write16(struct i2c_device *i2c, u16 reg, u16 val)
|
||||
int ret = 0;
|
||||
|
||||
if (mutex_lock_interruptible(i2c->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -249,7 +256,7 @@ static int dib8000_write_word(struct dib8000_state *state, u16 reg, u16 val)
|
||||
int ret;
|
||||
|
||||
if (mutex_lock_interruptible(&state->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -395,7 +402,7 @@ static void dib8000_set_acquisition_mode(struct dib8000_state *state)
|
||||
{
|
||||
u16 nud = dib8000_read_word(state, 298);
|
||||
nud |= (1 << 3) | (1 << 0);
|
||||
dprintk("acquisition mode activated");
|
||||
dprintk("acquisition mode activated\n");
|
||||
dib8000_write_word(state, 298, nud);
|
||||
}
|
||||
static int dib8000_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
@@ -408,7 +415,7 @@ static int dib8000_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
fifo_threshold = 1792;
|
||||
smo_mode = (dib8000_read_word(state, 299) & 0x0050) | (1 << 1);
|
||||
|
||||
dprintk("-I- Setting output mode for demod %p to %d",
|
||||
dprintk("-I- Setting output mode for demod %p to %d\n",
|
||||
&state->fe[0], mode);
|
||||
|
||||
switch (mode) {
|
||||
@@ -443,7 +450,7 @@ static int dib8000_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
break;
|
||||
|
||||
default:
|
||||
dprintk("Unhandled output_mode passed to be set for demod %p",
|
||||
dprintk("Unhandled output_mode passed to be set for demod %p\n",
|
||||
&state->fe[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -464,7 +471,7 @@ static int dib8000_set_diversity_in(struct dvb_frontend *fe, int onoff)
|
||||
struct dib8000_state *state = fe->demodulator_priv;
|
||||
u16 tmp, sync_wait = dib8000_read_word(state, 273) & 0xfff0;
|
||||
|
||||
dprintk("set diversity input to %i", onoff);
|
||||
dprintk("set diversity input to %i\n", onoff);
|
||||
if (!state->differential_constellation) {
|
||||
dib8000_write_word(state, 272, 1 << 9); //dvsy_off_lmod4 = 1
|
||||
dib8000_write_word(state, 273, sync_wait | (1 << 2) | 2); // sync_enable = 1; comb_mode = 2
|
||||
@@ -531,7 +538,7 @@ static void dib8000_set_power_mode(struct dib8000_state *state, enum dib8000_pow
|
||||
break;
|
||||
}
|
||||
|
||||
dprintk("powermode : 774 : %x ; 775 : %x; 776 : %x ; 900 : %x; 1280 : %x", reg_774, reg_775, reg_776, reg_900, reg_1280);
|
||||
dprintk("powermode : 774 : %x ; 775 : %x; 776 : %x ; 900 : %x; 1280 : %x\n", reg_774, reg_775, reg_776, reg_900, reg_1280);
|
||||
dib8000_write_word(state, 774, reg_774);
|
||||
dib8000_write_word(state, 775, reg_775);
|
||||
dib8000_write_word(state, 776, reg_776);
|
||||
@@ -619,10 +626,10 @@ static int dib8000_set_bandwidth(struct dvb_frontend *fe, u32 bw)
|
||||
bw = 6000;
|
||||
|
||||
if (state->timf == 0) {
|
||||
dprintk("using default timf");
|
||||
dprintk("using default timf\n");
|
||||
timf = state->timf_default;
|
||||
} else {
|
||||
dprintk("using updated timf");
|
||||
dprintk("using updated timf\n");
|
||||
timf = state->timf;
|
||||
}
|
||||
|
||||
@@ -667,7 +674,7 @@ static int dib8000_set_wbd_ref(struct dvb_frontend *fe, u16 value)
|
||||
|
||||
static void dib8000_reset_pll_common(struct dib8000_state *state, const struct dibx000_bandwidth_config *bw)
|
||||
{
|
||||
dprintk("ifreq: %d %x, inversion: %d", bw->ifreq, bw->ifreq, bw->ifreq >> 25);
|
||||
dprintk("ifreq: %d %x, inversion: %d\n", bw->ifreq, bw->ifreq, bw->ifreq >> 25);
|
||||
if (state->revision != 0x8090) {
|
||||
dib8000_write_word(state, 23,
|
||||
(u16) (((bw->internal * 1000) >> 16) & 0xffff));
|
||||
@@ -704,7 +711,7 @@ static void dib8000_reset_pll(struct dib8000_state *state)
|
||||
clk_cfg1 = (clk_cfg1 & 0xfff7) | (pll->pll_bypass << 3);
|
||||
dib8000_write_word(state, 902, clk_cfg1);
|
||||
|
||||
dprintk("clk_cfg1: 0x%04x", clk_cfg1);
|
||||
dprintk("clk_cfg1: 0x%04x\n", clk_cfg1);
|
||||
|
||||
/* smpl_cfg: P_refclksel=2, P_ensmplsel=1 nodivsmpl=1 */
|
||||
if (state->cfg.pll->ADClkSrc == 0)
|
||||
@@ -754,7 +761,7 @@ static int dib8000_update_pll(struct dvb_frontend *fe,
|
||||
pll->pll_ratio == loopdiv))
|
||||
return -EINVAL;
|
||||
|
||||
dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)", prediv, pll->pll_prediv, loopdiv, pll->pll_ratio);
|
||||
dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)\n", prediv, pll->pll_prediv, loopdiv, pll->pll_ratio);
|
||||
if (state->revision == 0x8090) {
|
||||
reg_1856 &= 0xf000;
|
||||
reg_1857 = dib8000_read_word(state, 1857);
|
||||
@@ -767,11 +774,11 @@ static int dib8000_update_pll(struct dvb_frontend *fe,
|
||||
|
||||
/* write new system clk into P_sec_len */
|
||||
internal = dib8000_read32(state, 23) / 1000;
|
||||
dprintk("Old Internal = %d", internal);
|
||||
dprintk("Old Internal = %d\n", internal);
|
||||
xtal = 2 * (internal / loopdiv) * prediv;
|
||||
internal = 1000 * (xtal/pll->pll_prediv) * pll->pll_ratio;
|
||||
dprintk("Xtal = %d , New Fmem = %d New Fdemod = %d, New Fsampling = %d", xtal, internal/1000, internal/2000, internal/8000);
|
||||
dprintk("New Internal = %d", internal);
|
||||
dprintk("Xtal = %d , New Fmem = %d New Fdemod = %d, New Fsampling = %d\n", xtal, internal/1000, internal/2000, internal/8000);
|
||||
dprintk("New Internal = %d\n", internal);
|
||||
|
||||
dib8000_write_word(state, 23,
|
||||
(u16) (((internal / 2) >> 16) & 0xffff));
|
||||
@@ -780,22 +787,22 @@ static int dib8000_update_pll(struct dvb_frontend *fe,
|
||||
dib8000_write_word(state, 1857, reg_1857 | (1 << 15));
|
||||
|
||||
while (((dib8000_read_word(state, 1856)>>15)&0x1) != 1)
|
||||
dprintk("Waiting for PLL to lock");
|
||||
dprintk("Waiting for PLL to lock\n");
|
||||
|
||||
/* verify */
|
||||
reg_1856 = dib8000_read_word(state, 1856);
|
||||
dprintk("PLL Updated with prediv = %d and loopdiv = %d",
|
||||
dprintk("PLL Updated with prediv = %d and loopdiv = %d\n",
|
||||
reg_1856&0x3f, (reg_1856>>6)&0x3f);
|
||||
} else {
|
||||
if (bw != state->current_demod_bw) {
|
||||
/** Bandwidth change => force PLL update **/
|
||||
dprintk("PLL: Bandwidth Change %d MHz -> %d MHz (prediv: %d->%d)", state->current_demod_bw / 1000, bw / 1000, oldprediv, state->cfg.pll->pll_prediv);
|
||||
dprintk("PLL: Bandwidth Change %d MHz -> %d MHz (prediv: %d->%d)\n", state->current_demod_bw / 1000, bw / 1000, oldprediv, state->cfg.pll->pll_prediv);
|
||||
|
||||
if (state->cfg.pll->pll_prediv != oldprediv) {
|
||||
/** Full PLL change only if prediv is changed **/
|
||||
|
||||
/** full update => bypass and reconfigure **/
|
||||
dprintk("PLL: New Setting for %d MHz Bandwidth (prediv: %d, ratio: %d)", bw/1000, state->cfg.pll->pll_prediv, state->cfg.pll->pll_ratio);
|
||||
dprintk("PLL: New Setting for %d MHz Bandwidth (prediv: %d, ratio: %d)\n", bw/1000, state->cfg.pll->pll_prediv, state->cfg.pll->pll_ratio);
|
||||
dib8000_write_word(state, 902, dib8000_read_word(state, 902) | (1<<3)); /* bypass PLL */
|
||||
dib8000_reset_pll(state);
|
||||
dib8000_write_word(state, 898, 0x0004); /* sad */
|
||||
@@ -807,7 +814,7 @@ static int dib8000_update_pll(struct dvb_frontend *fe,
|
||||
|
||||
if (ratio != 0) {
|
||||
/** ratio update => only change ratio **/
|
||||
dprintk("PLL: Update ratio (prediv: %d, ratio: %d)", state->cfg.pll->pll_prediv, ratio);
|
||||
dprintk("PLL: Update ratio (prediv: %d, ratio: %d)\n", state->cfg.pll->pll_prediv, ratio);
|
||||
dib8000_write_word(state, 901, (state->cfg.pll->pll_prediv << 8) | (ratio << 0)); /* only the PLL ratio is updated. */
|
||||
}
|
||||
}
|
||||
@@ -841,7 +848,7 @@ static int dib8000_cfg_gpio(struct dib8000_state *st, u8 num, u8 dir, u8 val)
|
||||
st->cfg.gpio_val |= (val & 0x01) << num; /* set the new value */
|
||||
dib8000_write_word(st, 1030, st->cfg.gpio_val);
|
||||
|
||||
dprintk("gpio dir: %x: gpio val: %x", st->cfg.gpio_dir, st->cfg.gpio_val);
|
||||
dprintk("gpio dir: %x: gpio val: %x\n", st->cfg.gpio_dir, st->cfg.gpio_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -958,29 +965,29 @@ static u16 dib8000_identify(struct i2c_device *client)
|
||||
value = dib8000_i2c_read16(client, 896);
|
||||
|
||||
if ((value = dib8000_i2c_read16(client, 896)) != 0x01b3) {
|
||||
dprintk("wrong Vendor ID (read=0x%x)", value);
|
||||
dprintk("wrong Vendor ID (read=0x%x)\n", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
value = dib8000_i2c_read16(client, 897);
|
||||
if (value != 0x8000 && value != 0x8001 &&
|
||||
value != 0x8002 && value != 0x8090) {
|
||||
dprintk("wrong Device ID (%x)", value);
|
||||
dprintk("wrong Device ID (%x)\n", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (value) {
|
||||
case 0x8000:
|
||||
dprintk("found DiB8000A");
|
||||
dprintk("found DiB8000A\n");
|
||||
break;
|
||||
case 0x8001:
|
||||
dprintk("found DiB8000B");
|
||||
dprintk("found DiB8000B\n");
|
||||
break;
|
||||
case 0x8002:
|
||||
dprintk("found DiB8000C");
|
||||
dprintk("found DiB8000C\n");
|
||||
break;
|
||||
case 0x8090:
|
||||
dprintk("found DiB8096P");
|
||||
dprintk("found DiB8096P\n");
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
@@ -1037,7 +1044,7 @@ static int dib8000_reset(struct dvb_frontend *fe)
|
||||
dib8000_write_word(state, 1287, 0x0003);
|
||||
|
||||
if (state->revision == 0x8000)
|
||||
dprintk("error : dib8000 MA not supported");
|
||||
dprintk("error : dib8000 MA not supported\n");
|
||||
|
||||
dibx000_reset_i2c_master(&state->i2c_master);
|
||||
|
||||
@@ -1069,7 +1076,7 @@ static int dib8000_reset(struct dvb_frontend *fe)
|
||||
if (state->cfg.drives)
|
||||
dib8000_write_word(state, 906, state->cfg.drives);
|
||||
else {
|
||||
dprintk("using standard PAD-drive-settings, please adjust settings in config-struct to be optimal.");
|
||||
dprintk("using standard PAD-drive-settings, please adjust settings in config-struct to be optimal.\n");
|
||||
/* min drive SDRAM - not optimal - adjust */
|
||||
dib8000_write_word(state, 906, 0x2d98);
|
||||
}
|
||||
@@ -1080,11 +1087,11 @@ static int dib8000_reset(struct dvb_frontend *fe)
|
||||
dib8000_write_word(state, 898, 0x0004);
|
||||
|
||||
if (dib8000_reset_gpio(state) != 0)
|
||||
dprintk("GPIO reset was not successful.");
|
||||
dprintk("GPIO reset was not successful.\n");
|
||||
|
||||
if ((state->revision != 0x8090) &&
|
||||
(dib8000_set_output_mode(fe, OUTMODE_HIGH_Z) != 0))
|
||||
dprintk("OUTPUT_MODE could not be resetted.");
|
||||
dprintk("OUTPUT_MODE could not be resetted.\n");
|
||||
|
||||
state->current_agc = NULL;
|
||||
|
||||
@@ -1176,7 +1183,7 @@ static int dib8000_set_agc_config(struct dib8000_state *state, u8 band)
|
||||
}
|
||||
|
||||
if (agc == NULL) {
|
||||
dprintk("no valid AGC configuration found for band 0x%02x", band);
|
||||
dprintk("no valid AGC configuration found for band 0x%02x\n", band);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1192,7 +1199,7 @@ static int dib8000_set_agc_config(struct dib8000_state *state, u8 band)
|
||||
dib8000_write_word(state, 102, (agc->alpha_mant << 5) | agc->alpha_exp);
|
||||
dib8000_write_word(state, 103, (agc->beta_mant << 6) | agc->beta_exp);
|
||||
|
||||
dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d",
|
||||
dprintk("WBD: ref: %d, sel: %d, active: %d, alpha: %d\n",
|
||||
state->wbd_ref != 0 ? state->wbd_ref : agc->wbd_ref, agc->wbd_sel, !agc->perform_agc_softsplit, agc->wbd_sel);
|
||||
|
||||
/* AGC continued */
|
||||
@@ -1251,7 +1258,7 @@ static int dib8000_agc_soft_split(struct dib8000_state *state)
|
||||
(agc - state->current_agc->split.min_thres) /
|
||||
(state->current_agc->split.max_thres - state->current_agc->split.min_thres);
|
||||
|
||||
dprintk("AGC split_offset: %d", split_offset);
|
||||
dprintk("AGC split_offset: %d\n", split_offset);
|
||||
|
||||
// P_agc_force_split and P_agc_split_offset
|
||||
dib8000_write_word(state, 107, (dib8000_read_word(state, 107) & 0xff00) | split_offset);
|
||||
@@ -1395,7 +1402,7 @@ static void dib8096p_cfg_DibTx(struct dib8000_state *state, u32 P_Kin,
|
||||
u32 P_Kout, u32 insertExtSynchro, u32 synchroMode,
|
||||
u32 syncWord, u32 syncSize)
|
||||
{
|
||||
dprintk("Configure DibStream Tx");
|
||||
dprintk("Configure DibStream Tx\n");
|
||||
|
||||
dib8000_write_word(state, 1615, 1);
|
||||
dib8000_write_word(state, 1603, P_Kin);
|
||||
@@ -1414,7 +1421,7 @@ static void dib8096p_cfg_DibRx(struct dib8000_state *state, u32 P_Kin,
|
||||
{
|
||||
u32 syncFreq;
|
||||
|
||||
dprintk("Configure DibStream Rx synchroMode = %d", synchroMode);
|
||||
dprintk("Configure DibStream Rx synchroMode = %d\n", synchroMode);
|
||||
|
||||
if ((P_Kin != 0) && (P_Kout != 0)) {
|
||||
syncFreq = dib8096p_calcSyncFreq(P_Kin, P_Kout,
|
||||
@@ -1456,7 +1463,7 @@ static void dib8096p_configMpegMux(struct dib8000_state *state,
|
||||
{
|
||||
u16 reg_1287;
|
||||
|
||||
dprintk("Enable Mpeg mux");
|
||||
dprintk("Enable Mpeg mux\n");
|
||||
|
||||
dib8096p_enMpegMux(state, 0);
|
||||
|
||||
@@ -1477,15 +1484,15 @@ static void dib8096p_setDibTxMux(struct dib8000_state *state, int mode)
|
||||
|
||||
switch (mode) {
|
||||
case MPEG_ON_DIBTX:
|
||||
dprintk("SET MPEG ON DIBSTREAM TX");
|
||||
dprintk("SET MPEG ON DIBSTREAM TX\n");
|
||||
dib8096p_cfg_DibTx(state, 8, 5, 0, 0, 0, 0);
|
||||
reg_1288 |= (1 << 9); break;
|
||||
case DIV_ON_DIBTX:
|
||||
dprintk("SET DIV_OUT ON DIBSTREAM TX");
|
||||
dprintk("SET DIV_OUT ON DIBSTREAM TX\n");
|
||||
dib8096p_cfg_DibTx(state, 5, 5, 0, 0, 0, 0);
|
||||
reg_1288 |= (1 << 8); break;
|
||||
case ADC_ON_DIBTX:
|
||||
dprintk("SET ADC_OUT ON DIBSTREAM TX");
|
||||
dprintk("SET ADC_OUT ON DIBSTREAM TX\n");
|
||||
dib8096p_cfg_DibTx(state, 20, 5, 10, 0, 0, 0);
|
||||
reg_1288 |= (1 << 7); break;
|
||||
default:
|
||||
@@ -1500,17 +1507,17 @@ static void dib8096p_setHostBusMux(struct dib8000_state *state, int mode)
|
||||
|
||||
switch (mode) {
|
||||
case DEMOUT_ON_HOSTBUS:
|
||||
dprintk("SET DEM OUT OLD INTERF ON HOST BUS");
|
||||
dprintk("SET DEM OUT OLD INTERF ON HOST BUS\n");
|
||||
dib8096p_enMpegMux(state, 0);
|
||||
reg_1288 |= (1 << 6);
|
||||
break;
|
||||
case DIBTX_ON_HOSTBUS:
|
||||
dprintk("SET DIBSTREAM TX ON HOST BUS");
|
||||
dprintk("SET DIBSTREAM TX ON HOST BUS\n");
|
||||
dib8096p_enMpegMux(state, 0);
|
||||
reg_1288 |= (1 << 5);
|
||||
break;
|
||||
case MPEG_ON_HOSTBUS:
|
||||
dprintk("SET MPEG MUX ON HOST BUS");
|
||||
dprintk("SET MPEG MUX ON HOST BUS\n");
|
||||
reg_1288 |= (1 << 4);
|
||||
break;
|
||||
default:
|
||||
@@ -1526,7 +1533,7 @@ static int dib8096p_set_diversity_in(struct dvb_frontend *fe, int onoff)
|
||||
|
||||
switch (onoff) {
|
||||
case 0: /* only use the internal way - not the diversity input */
|
||||
dprintk("%s mode OFF : by default Enable Mpeg INPUT",
|
||||
dprintk("%s mode OFF : by default Enable Mpeg INPUT\n",
|
||||
__func__);
|
||||
/* outputRate = 8 */
|
||||
dib8096p_cfg_DibRx(state, 8, 5, 0, 0, 0, 8, 0);
|
||||
@@ -1544,7 +1551,7 @@ static int dib8096p_set_diversity_in(struct dvb_frontend *fe, int onoff)
|
||||
break;
|
||||
case 1: /* both ways */
|
||||
case 2: /* only the diversity input */
|
||||
dprintk("%s ON : Enable diversity INPUT", __func__);
|
||||
dprintk("%s ON : Enable diversity INPUT\n", __func__);
|
||||
dib8096p_cfg_DibRx(state, 5, 5, 0, 0, 0, 0, 0);
|
||||
state->input_mode_mpeg = 0;
|
||||
break;
|
||||
@@ -1576,11 +1583,11 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
|
||||
case OUTMODE_MPEG2_SERIAL:
|
||||
if (prefer_mpeg_mux_use) {
|
||||
dprintk("dib8096P setting output mode TS_SERIAL using Mpeg Mux");
|
||||
dprintk("dib8096P setting output mode TS_SERIAL using Mpeg Mux\n");
|
||||
dib8096p_configMpegMux(state, 3, 1, 1);
|
||||
dib8096p_setHostBusMux(state, MPEG_ON_HOSTBUS);
|
||||
} else {/* Use Smooth block */
|
||||
dprintk("dib8096P setting output mode TS_SERIAL using Smooth bloc");
|
||||
dprintk("dib8096P setting output mode TS_SERIAL using Smooth bloc\n");
|
||||
dib8096p_setHostBusMux(state,
|
||||
DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (2 << 6) | (0 << 1);
|
||||
@@ -1589,11 +1596,11 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
|
||||
case OUTMODE_MPEG2_PAR_GATED_CLK:
|
||||
if (prefer_mpeg_mux_use) {
|
||||
dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Mpeg Mux");
|
||||
dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Mpeg Mux\n");
|
||||
dib8096p_configMpegMux(state, 2, 0, 0);
|
||||
dib8096p_setHostBusMux(state, MPEG_ON_HOSTBUS);
|
||||
} else { /* Use Smooth block */
|
||||
dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Smooth block");
|
||||
dprintk("dib8096P setting output mode TS_PARALLEL_GATED using Smooth block\n");
|
||||
dib8096p_setHostBusMux(state,
|
||||
DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (0 << 6);
|
||||
@@ -1601,7 +1608,7 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
break;
|
||||
|
||||
case OUTMODE_MPEG2_PAR_CONT_CLK: /* Using Smooth block only */
|
||||
dprintk("dib8096P setting output mode TS_PARALLEL_CONT using Smooth block");
|
||||
dprintk("dib8096P setting output mode TS_PARALLEL_CONT using Smooth block\n");
|
||||
dib8096p_setHostBusMux(state, DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (1 << 6);
|
||||
break;
|
||||
@@ -1609,7 +1616,7 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
case OUTMODE_MPEG2_FIFO:
|
||||
/* Using Smooth block because not supported
|
||||
by new Mpeg Mux bloc */
|
||||
dprintk("dib8096P setting output mode TS_FIFO using Smooth block");
|
||||
dprintk("dib8096P setting output mode TS_FIFO using Smooth block\n");
|
||||
dib8096p_setHostBusMux(state, DEMOUT_ON_HOSTBUS);
|
||||
outreg |= (5 << 6);
|
||||
smo_mode |= (3 << 1);
|
||||
@@ -1617,13 +1624,13 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
break;
|
||||
|
||||
case OUTMODE_DIVERSITY:
|
||||
dprintk("dib8096P setting output mode MODE_DIVERSITY");
|
||||
dprintk("dib8096P setting output mode MODE_DIVERSITY\n");
|
||||
dib8096p_setDibTxMux(state, DIV_ON_DIBTX);
|
||||
dib8096p_setHostBusMux(state, DIBTX_ON_HOSTBUS);
|
||||
break;
|
||||
|
||||
case OUTMODE_ANALOG_ADC:
|
||||
dprintk("dib8096P setting output mode MODE_ANALOG_ADC");
|
||||
dprintk("dib8096P setting output mode MODE_ANALOG_ADC\n");
|
||||
dib8096p_setDibTxMux(state, ADC_ON_DIBTX);
|
||||
dib8096p_setHostBusMux(state, DIBTX_ON_HOSTBUS);
|
||||
break;
|
||||
@@ -1632,7 +1639,7 @@ static int dib8096p_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
if (mode != OUTMODE_HIGH_Z)
|
||||
outreg |= (1<<10);
|
||||
|
||||
dprintk("output_mpeg2_in_188_bytes = %d",
|
||||
dprintk("output_mpeg2_in_188_bytes = %d\n",
|
||||
state->cfg.output_mpeg2_in_188_bytes);
|
||||
if (state->cfg.output_mpeg2_in_188_bytes)
|
||||
smo_mode |= (1 << 5);
|
||||
@@ -1678,7 +1685,7 @@ static int dib8096p_tuner_write_serpar(struct i2c_adapter *i2c_adap,
|
||||
n_overflow = (dib8000_read_word(state, 1984) >> 1) & 0x1;
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("Tuner ITF: write busy (overflow)");
|
||||
dprintk("Tuner ITF: write busy (overflow)\n");
|
||||
}
|
||||
dib8000_write_word(state, 1985, (1 << 6) | (serpar_num & 0x3f));
|
||||
dib8000_write_word(state, 1986, (msg[0].buf[1] << 8) | msg[0].buf[2]);
|
||||
@@ -1699,7 +1706,7 @@ static int dib8096p_tuner_read_serpar(struct i2c_adapter *i2c_adap,
|
||||
n_overflow = (dib8000_read_word(state, 1984) >> 1) & 0x1;
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("TunerITF: read busy (overflow)");
|
||||
dprintk("TunerITF: read busy (overflow)\n");
|
||||
}
|
||||
dib8000_write_word(state, 1985, (0<<6) | (serpar_num&0x3f));
|
||||
|
||||
@@ -1708,7 +1715,7 @@ static int dib8096p_tuner_read_serpar(struct i2c_adapter *i2c_adap,
|
||||
n_empty = dib8000_read_word(state, 1984)&0x1;
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("TunerITF: read busy (empty)");
|
||||
dprintk("TunerITF: read busy (empty)\n");
|
||||
}
|
||||
|
||||
read_word = dib8000_read_word(state, 1987);
|
||||
@@ -1889,7 +1896,7 @@ static int dib8096p_tuner_sleep(struct dvb_frontend *fe, int onoff)
|
||||
struct dib8000_state *state = fe->demodulator_priv;
|
||||
u16 en_cur_state;
|
||||
|
||||
dprintk("sleep dib8096p: %d", onoff);
|
||||
dprintk("sleep dib8096p: %d\n", onoff);
|
||||
|
||||
en_cur_state = dib8000_read_word(state, 1922);
|
||||
|
||||
@@ -1958,7 +1965,7 @@ static void dib8000_update_timf(struct dib8000_state *state)
|
||||
|
||||
dib8000_write_word(state, 29, (u16) (timf >> 16));
|
||||
dib8000_write_word(state, 30, (u16) (timf & 0xffff));
|
||||
dprintk("Updated timing frequency: %d (default: %d)", state->timf, state->timf_default);
|
||||
dprintk("Updated timing frequency: %d (default: %d)\n", state->timf, state->timf_default);
|
||||
}
|
||||
|
||||
static u32 dib8000_ctrl_timf(struct dvb_frontend *fe, uint8_t op, uint32_t timf)
|
||||
@@ -2118,7 +2125,7 @@ static u16 dib8000_get_init_prbs(struct dib8000_state *state, u16 subchannel)
|
||||
int sub_channel_prbs_group = 0;
|
||||
|
||||
sub_channel_prbs_group = (subchannel / 3) + 1;
|
||||
dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x", sub_channel_prbs_group, subchannel, lut_prbs_8k[sub_channel_prbs_group]);
|
||||
dprintk("sub_channel_prbs_group = %d , subchannel =%d prbs = 0x%04x\n", sub_channel_prbs_group, subchannel, lut_prbs_8k[sub_channel_prbs_group]);
|
||||
|
||||
switch (state->fe[0]->dtv_property_cache.transmission_mode) {
|
||||
case TRANSMISSION_MODE_2K:
|
||||
@@ -2604,7 +2611,7 @@ static int dib8000_autosearch_start(struct dvb_frontend *fe)
|
||||
slist = 0;
|
||||
}
|
||||
}
|
||||
dprintk("Using list for autosearch : %d", slist);
|
||||
dprintk("Using list for autosearch : %d\n", slist);
|
||||
|
||||
dib8000_set_isdbt_common_channel(state, slist, 1);
|
||||
|
||||
@@ -2638,17 +2645,17 @@ static int dib8000_autosearch_irq(struct dvb_frontend *fe)
|
||||
if ((state->revision >= 0x8002) &&
|
||||
(state->autosearch_state == AS_SEARCHING_FFT)) {
|
||||
if (irq_pending & 0x1) {
|
||||
dprintk("dib8000_autosearch_irq: max correlation result available");
|
||||
dprintk("dib8000_autosearch_irq: max correlation result available\n");
|
||||
return 3;
|
||||
}
|
||||
} else {
|
||||
if (irq_pending & 0x1) { /* failed */
|
||||
dprintk("dib8000_autosearch_irq failed");
|
||||
dprintk("dib8000_autosearch_irq failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (irq_pending & 0x2) { /* succeeded */
|
||||
dprintk("dib8000_autosearch_irq succeeded");
|
||||
dprintk("dib8000_autosearch_irq succeeded\n");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@@ -2699,7 +2706,7 @@ static void dib8000_set_dds(struct dib8000_state *state, s32 offset_khz)
|
||||
dds += abs_offset_khz * unit_khz_dds_val;
|
||||
}
|
||||
|
||||
dprintk("setting a DDS frequency offset of %c%dkHz", invert ? '-' : ' ', dds / unit_khz_dds_val);
|
||||
dprintk("setting a DDS frequency offset of %c%dkHz\n", invert ? '-' : ' ', dds / unit_khz_dds_val);
|
||||
|
||||
if (abs_offset_khz <= (state->cfg.pll->internal / ratio)) {
|
||||
/* Max dds offset is the half of the demod freq */
|
||||
@@ -2738,7 +2745,7 @@ static void dib8000_set_frequency_offset(struct dib8000_state *state)
|
||||
}
|
||||
}
|
||||
|
||||
dprintk("%dkhz tuner offset (frequency = %dHz & current_rf = %dHz) total_dds_offset_hz = %d", c->frequency - current_rf, c->frequency, current_rf, total_dds_offset_khz);
|
||||
dprintk("%dkhz tuner offset (frequency = %dHz & current_rf = %dHz) total_dds_offset_hz = %d\n", c->frequency - current_rf, c->frequency, current_rf, total_dds_offset_khz);
|
||||
|
||||
/* apply dds offset now */
|
||||
dib8000_set_dds(state, total_dds_offset_khz);
|
||||
@@ -2890,7 +2897,7 @@ static u16 dib8000_read_lock(struct dvb_frontend *fe)
|
||||
static int dib8090p_init_sdram(struct dib8000_state *state)
|
||||
{
|
||||
u16 reg = 0;
|
||||
dprintk("init sdram");
|
||||
dprintk("init sdram\n");
|
||||
|
||||
reg = dib8000_read_word(state, 274) & 0xfff0;
|
||||
dib8000_write_word(state, 274, reg | 0x7); /* P_dintlv_delay_ram = 7 because of MobileSdram */
|
||||
@@ -2931,7 +2938,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c)
|
||||
* Transmission mode is only detected on auto mode, currently
|
||||
*/
|
||||
if (c->transmission_mode == TRANSMISSION_MODE_AUTO) {
|
||||
dprintk("transmission mode auto");
|
||||
dprintk("transmission mode auto\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2939,7 +2946,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c)
|
||||
* Guard interval is only detected on auto mode, currently
|
||||
*/
|
||||
if (c->guard_interval == GUARD_INTERVAL_AUTO) {
|
||||
dprintk("guard interval auto");
|
||||
dprintk("guard interval auto\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2948,7 +2955,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c)
|
||||
* layer should be enabled
|
||||
*/
|
||||
if (!c->isdbt_layer_enabled) {
|
||||
dprintk("no layer modulation specified");
|
||||
dprintk("no layer modulation specified\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2970,7 +2977,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c)
|
||||
|
||||
if ((c->layer[i].modulation == QAM_AUTO) ||
|
||||
(c->layer[i].fec == FEC_AUTO)) {
|
||||
dprintk("layer %c has either modulation or FEC auto",
|
||||
dprintk("layer %c has either modulation or FEC auto\n",
|
||||
'A' + i);
|
||||
return 0;
|
||||
}
|
||||
@@ -2981,7 +2988,7 @@ static int is_manual_mode(struct dtv_frontend_properties *c)
|
||||
* fallback to auto mode.
|
||||
*/
|
||||
if (n_segs == 0 || n_segs > 13) {
|
||||
dprintk("number of segments is invalid");
|
||||
dprintk("number of segments is invalid\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3009,7 +3016,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
|
||||
#if 0
|
||||
if (*tune_state < CT_DEMOD_STOP)
|
||||
dprintk("IN: context status = %d, TUNE_STATE %d autosearch step = %u jiffies = %lu",
|
||||
dprintk("IN: context status = %d, TUNE_STATE %d autosearch step = %u jiffies = %lu\n",
|
||||
state->channel_parameters_set, *tune_state, state->autosearch_state, now);
|
||||
#endif
|
||||
|
||||
@@ -3022,7 +3029,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
state->status = FE_STATUS_TUNE_PENDING;
|
||||
state->channel_parameters_set = is_manual_mode(c);
|
||||
|
||||
dprintk("Tuning channel on %s search mode",
|
||||
dprintk("Tuning channel on %s search mode\n",
|
||||
state->channel_parameters_set ? "manual" : "auto");
|
||||
|
||||
dib8000_viterbi_state(state, 0); /* force chan dec in restart */
|
||||
@@ -3102,7 +3109,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
corm[1] = (dib8000_read_word(state, 596) << 16) | (dib8000_read_word(state, 597));
|
||||
corm[0] = (dib8000_read_word(state, 598) << 16) | (dib8000_read_word(state, 599));
|
||||
}
|
||||
/* dprintk("corm fft: %u %u %u", corm[0], corm[1], corm[2]); */
|
||||
/* dprintk("corm fft: %u %u %u\n", corm[0], corm[1], corm[2]); */
|
||||
|
||||
max_value = 0;
|
||||
for (find_index = 1 ; find_index < 3 ; find_index++) {
|
||||
@@ -3122,7 +3129,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
state->found_nfft = TRANSMISSION_MODE_8K;
|
||||
break;
|
||||
}
|
||||
/* dprintk("Autosearch FFT has found Mode %d", max_value + 1); */
|
||||
/* dprintk("Autosearch FFT has found Mode %d\n", max_value + 1); */
|
||||
|
||||
*tune_state = CT_DEMOD_SEARCH_NEXT;
|
||||
state->autosearch_state = AS_SEARCHING_GUARD;
|
||||
@@ -3137,7 +3144,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
state->found_guard = dib8000_read_word(state, 572) & 0x3;
|
||||
else
|
||||
state->found_guard = dib8000_read_word(state, 570) & 0x3;
|
||||
/* dprintk("guard interval found=%i", state->found_guard); */
|
||||
/* dprintk("guard interval found=%i\n", state->found_guard); */
|
||||
|
||||
*tune_state = CT_DEMOD_STEP_3;
|
||||
break;
|
||||
@@ -3233,7 +3240,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
/* defines timeout for mpeg lock depending on interleaver length of longest layer */
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (c->layer[i].interleaving >= deeper_interleaver) {
|
||||
dprintk("layer%i: time interleaver = %d ", i, c->layer[i].interleaving);
|
||||
dprintk("layer%i: time interleaver = %d\n", i, c->layer[i].interleaving);
|
||||
if (c->layer[i].segment_count > 0) { /* valid layer */
|
||||
deeper_interleaver = c->layer[0].interleaving;
|
||||
state->longest_intlv_layer = i;
|
||||
@@ -3252,7 +3259,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
locks *= 2;
|
||||
|
||||
*timeout = now + msecs_to_jiffies(200 * locks); /* give the mpeg lock 800ms if sram is present */
|
||||
dprintk("Deeper interleaver mode = %d on layer %d : timeout mult factor = %d => will use timeout = %ld",
|
||||
dprintk("Deeper interleaver mode = %d on layer %d : timeout mult factor = %d => will use timeout = %ld\n",
|
||||
deeper_interleaver, state->longest_intlv_layer, locks, *timeout);
|
||||
|
||||
*tune_state = CT_DEMOD_STEP_10;
|
||||
@@ -3263,7 +3270,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
case CT_DEMOD_STEP_10: /* 40 */
|
||||
locks = dib8000_read_lock(fe);
|
||||
if (locks&(1<<(7-state->longest_intlv_layer))) { /* mpeg lock : check the longest one */
|
||||
dprintk("ISDB-T layer locks: Layer A %s, Layer B %s, Layer C %s",
|
||||
dprintk("ISDB-T layer locks: Layer A %s, Layer B %s, Layer C %s\n",
|
||||
c->layer[0].segment_count ? (locks >> 7) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled",
|
||||
c->layer[1].segment_count ? (locks >> 6) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled",
|
||||
c->layer[2].segment_count ? (locks >> 5) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled");
|
||||
@@ -3283,7 +3290,7 @@ static int dib8000_tune(struct dvb_frontend *fe)
|
||||
*tune_state = CT_DEMOD_STEP_11;
|
||||
} else { /* we are done mpeg of the longest interleaver xas not locking but let's try if an other layer has locked in the same time */
|
||||
if (locks & (0x7 << 5)) {
|
||||
dprintk("Not all ISDB-T layers locked in %d ms: Layer A %s, Layer B %s, Layer C %s",
|
||||
dprintk("Not all ISDB-T layers locked in %d ms: Layer A %s, Layer B %s, Layer C %s\n",
|
||||
jiffies_to_msecs(now - *timeout),
|
||||
c->layer[0].segment_count ? (locks >> 7) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled",
|
||||
c->layer[1].segment_count ? (locks >> 6) & 0x1 ? "locked" : "NOT LOCKED" : "not enabled",
|
||||
@@ -3348,7 +3355,7 @@ static int dib8000_wakeup(struct dvb_frontend *fe)
|
||||
dib8000_set_power_mode(state, DIB8000_POWER_ALL);
|
||||
dib8000_set_adc_state(state, DIBX000_ADC_ON);
|
||||
if (dib8000_set_adc_state(state, DIBX000_SLOW_ADC_ON) != 0)
|
||||
dprintk("could not start Slow ADC");
|
||||
dprintk("could not start Slow ADC\n");
|
||||
|
||||
if (state->revision == 0x8090)
|
||||
dib8000_sad_calib(state);
|
||||
@@ -3401,11 +3408,11 @@ static int dib8000_get_frontend(struct dvb_frontend *fe,
|
||||
if (!(stat & FE_HAS_SYNC))
|
||||
return 0;
|
||||
|
||||
dprintk("dib8000_get_frontend: TMCC lock");
|
||||
dprintk("dib8000_get_frontend: TMCC lock\n");
|
||||
for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) {
|
||||
state->fe[index_frontend]->ops.read_status(state->fe[index_frontend], &stat);
|
||||
if (stat&FE_HAS_SYNC) {
|
||||
dprintk("TMCC lock on the slave%i", index_frontend);
|
||||
dprintk("TMCC lock on the slave%i\n", index_frontend);
|
||||
/* synchronize the cache with the other frontends */
|
||||
state->fe[index_frontend]->ops.get_frontend(state->fe[index_frontend], c);
|
||||
for (sub_index_frontend = 0; (sub_index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[sub_index_frontend] != NULL); sub_index_frontend++) {
|
||||
@@ -3437,41 +3444,41 @@ static int dib8000_get_frontend(struct dvb_frontend *fe,
|
||||
switch ((val & 0x30) >> 4) {
|
||||
case 1:
|
||||
c->transmission_mode = TRANSMISSION_MODE_2K;
|
||||
dprintk("dib8000_get_frontend: transmission mode 2K");
|
||||
dprintk("dib8000_get_frontend: transmission mode 2K\n");
|
||||
break;
|
||||
case 2:
|
||||
c->transmission_mode = TRANSMISSION_MODE_4K;
|
||||
dprintk("dib8000_get_frontend: transmission mode 4K");
|
||||
dprintk("dib8000_get_frontend: transmission mode 4K\n");
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
c->transmission_mode = TRANSMISSION_MODE_8K;
|
||||
dprintk("dib8000_get_frontend: transmission mode 8K");
|
||||
dprintk("dib8000_get_frontend: transmission mode 8K\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (val & 0x3) {
|
||||
case 0:
|
||||
c->guard_interval = GUARD_INTERVAL_1_32;
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/32 ");
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/32\n");
|
||||
break;
|
||||
case 1:
|
||||
c->guard_interval = GUARD_INTERVAL_1_16;
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/16 ");
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/16\n");
|
||||
break;
|
||||
case 2:
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/8 ");
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/8\n");
|
||||
c->guard_interval = GUARD_INTERVAL_1_8;
|
||||
break;
|
||||
case 3:
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/4 ");
|
||||
dprintk("dib8000_get_frontend: Guard Interval = 1/4\n");
|
||||
c->guard_interval = GUARD_INTERVAL_1_4;
|
||||
break;
|
||||
}
|
||||
|
||||
val = dib8000_read_word(state, 505);
|
||||
c->isdbt_partial_reception = val & 1;
|
||||
dprintk("dib8000_get_frontend: partial_reception = %d ", c->isdbt_partial_reception);
|
||||
dprintk("dib8000_get_frontend: partial_reception = %d\n", c->isdbt_partial_reception);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
int show;
|
||||
@@ -3485,7 +3492,7 @@ static int dib8000_get_frontend(struct dvb_frontend *fe,
|
||||
show = 1;
|
||||
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d segments = %d ",
|
||||
dprintk("dib8000_get_frontend: Layer %d segments = %d\n",
|
||||
i, c->layer[i].segment_count);
|
||||
|
||||
val = dib8000_read_word(state, 499 + i) & 0x3;
|
||||
@@ -3494,7 +3501,7 @@ static int dib8000_get_frontend(struct dvb_frontend *fe,
|
||||
val = 4;
|
||||
c->layer[i].interleaving = val;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d time_intlv = %d ",
|
||||
dprintk("dib8000_get_frontend: Layer %d time_intlv = %d\n",
|
||||
i, c->layer[i].interleaving);
|
||||
|
||||
val = dib8000_read_word(state, 481 + i);
|
||||
@@ -3502,27 +3509,27 @@ static int dib8000_get_frontend(struct dvb_frontend *fe,
|
||||
case 1:
|
||||
c->layer[i].fec = FEC_1_2;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 1/2 ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 1/2\n", i);
|
||||
break;
|
||||
case 2:
|
||||
c->layer[i].fec = FEC_2_3;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 2/3 ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 2/3\n", i);
|
||||
break;
|
||||
case 3:
|
||||
c->layer[i].fec = FEC_3_4;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 3/4 ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 3/4\n", i);
|
||||
break;
|
||||
case 5:
|
||||
c->layer[i].fec = FEC_5_6;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 5/6 ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 5/6\n", i);
|
||||
break;
|
||||
default:
|
||||
c->layer[i].fec = FEC_7_8;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 7/8 ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d Code Rate = 7/8\n", i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3531,23 +3538,23 @@ static int dib8000_get_frontend(struct dvb_frontend *fe,
|
||||
case 0:
|
||||
c->layer[i].modulation = DQPSK;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d DQPSK ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d DQPSK\n", i);
|
||||
break;
|
||||
case 1:
|
||||
c->layer[i].modulation = QPSK;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d QPSK ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d QPSK\n", i);
|
||||
break;
|
||||
case 2:
|
||||
c->layer[i].modulation = QAM_16;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d QAM16 ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d QAM16\n", i);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
c->layer[i].modulation = QAM_64;
|
||||
if (show)
|
||||
dprintk("dib8000_get_frontend: Layer %d QAM64 ", i);
|
||||
dprintk("dib8000_get_frontend: Layer %d QAM64\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3578,12 +3585,12 @@ static int dib8000_set_frontend(struct dvb_frontend *fe)
|
||||
unsigned long delay, callback_time;
|
||||
|
||||
if (c->frequency == 0) {
|
||||
dprintk("dib8000: must at least specify frequency ");
|
||||
dprintk("dib8000: must at least specify frequency\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (c->bandwidth_hz == 0) {
|
||||
dprintk("dib8000: no bandwidth specified, set to default ");
|
||||
dprintk("dib8000: no bandwidth specified, set to default\n");
|
||||
c->bandwidth_hz = 6000000;
|
||||
}
|
||||
|
||||
@@ -3671,7 +3678,7 @@ static int dib8000_set_frontend(struct dvb_frontend *fe)
|
||||
/* we are in autosearch */
|
||||
if (state->channel_parameters_set == 0) { /* searching */
|
||||
if ((dib8000_get_status(state->fe[index_frontend]) == FE_STATUS_DEMOD_SUCCESS) || (dib8000_get_status(state->fe[index_frontend]) == FE_STATUS_FFT_SUCCESS)) {
|
||||
dprintk("autosearch succeeded on fe%i", index_frontend);
|
||||
dprintk("autosearch succeeded on fe%i\n", index_frontend);
|
||||
dib8000_get_frontend(state->fe[index_frontend], c); /* we read the channel parameters from the frontend which was successful */
|
||||
state->channel_parameters_set = 1;
|
||||
|
||||
@@ -3708,11 +3715,11 @@ static int dib8000_set_frontend(struct dvb_frontend *fe)
|
||||
active = 1;
|
||||
}
|
||||
if (active == 0)
|
||||
dprintk("tuning done with status %d", dib8000_get_status(state->fe[0]));
|
||||
dprintk("tuning done with status %d\n", dib8000_get_status(state->fe[0]));
|
||||
}
|
||||
|
||||
if ((active == 1) && (callback_time == 0)) {
|
||||
dprintk("strange callback time something went wrong");
|
||||
dprintk("strange callback time something went wrong\n");
|
||||
active = 0;
|
||||
}
|
||||
|
||||
@@ -4172,7 +4179,7 @@ static int dib8000_get_stats(struct dvb_frontend *fe, enum fe_status stat)
|
||||
time_us = dib8000_get_time_us(fe, -1);
|
||||
state->ber_jiffies_stats = jiffies + msecs_to_jiffies((time_us + 500) / 1000);
|
||||
|
||||
dprintk("Next all layers stats available in %u us.", time_us);
|
||||
dprintk("Next all layers stats available in %u us.\n", time_us);
|
||||
|
||||
dib8000_read_ber(fe, &val);
|
||||
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
|
||||
@@ -4239,12 +4246,12 @@ static int dib8000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_fronte
|
||||
while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL))
|
||||
index_frontend++;
|
||||
if (index_frontend < MAX_NUMBER_OF_FRONTENDS) {
|
||||
dprintk("set slave fe %p to index %i", fe_slave, index_frontend);
|
||||
dprintk("set slave fe %p to index %i\n", fe_slave, index_frontend);
|
||||
state->fe[index_frontend] = fe_slave;
|
||||
return 0;
|
||||
}
|
||||
|
||||
dprintk("too many slave frontend");
|
||||
dprintk("too many slave frontend\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -4256,12 +4263,12 @@ static int dib8000_remove_slave_frontend(struct dvb_frontend *fe)
|
||||
while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL))
|
||||
index_frontend++;
|
||||
if (index_frontend != 1) {
|
||||
dprintk("remove slave fe %p (index %i)", state->fe[index_frontend-1], index_frontend-1);
|
||||
dprintk("remove slave fe %p (index %i)\n", state->fe[index_frontend-1], index_frontend-1);
|
||||
state->fe[index_frontend] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
dprintk("no frontend to be removed");
|
||||
dprintk("no frontend to be removed\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -4283,18 +4290,18 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods,
|
||||
|
||||
client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
|
||||
if (!client.i2c_write_buffer) {
|
||||
dprintk("%s: not enough memory", __func__);
|
||||
dprintk("%s: not enough memory\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
|
||||
if (!client.i2c_read_buffer) {
|
||||
dprintk("%s: not enough memory", __func__);
|
||||
dprintk("%s: not enough memory\n", __func__);
|
||||
ret = -ENOMEM;
|
||||
goto error_memory_read;
|
||||
}
|
||||
client.i2c_buffer_lock = kzalloc(sizeof(struct mutex), GFP_KERNEL);
|
||||
if (!client.i2c_buffer_lock) {
|
||||
dprintk("%s: not enough memory", __func__);
|
||||
dprintk("%s: not enough memory\n", __func__);
|
||||
ret = -ENOMEM;
|
||||
goto error_memory_lock;
|
||||
}
|
||||
@@ -4313,7 +4320,7 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods,
|
||||
dib8000_i2c_write16(&client, 1287, 0x0003);
|
||||
client.addr = default_addr;
|
||||
if (dib8000_identify(&client) == 0) {
|
||||
dprintk("#%d: not identified", k);
|
||||
dprintk("#%d: not identified\n", k);
|
||||
ret = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
@@ -4327,7 +4334,7 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods,
|
||||
client.addr = new_addr;
|
||||
dib8000_identify(&client);
|
||||
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr);
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr);
|
||||
}
|
||||
|
||||
for (k = 0; k < no_of_demods; k++) {
|
||||
@@ -4385,14 +4392,14 @@ static int dib8000_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
|
||||
u16 val = dib8000_read_word(st, 299) & 0xffef;
|
||||
val |= (onoff & 0x1) << 4;
|
||||
|
||||
dprintk("pid filter enabled %d", onoff);
|
||||
dprintk("pid filter enabled %d\n", onoff);
|
||||
return dib8000_write_word(st, 299, val);
|
||||
}
|
||||
|
||||
static int dib8000_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
|
||||
{
|
||||
struct dib8000_state *st = fe->demodulator_priv;
|
||||
dprintk("Index %x, PID %d, OnOff %d", id, pid, onoff);
|
||||
dprintk("Index %x, PID %d, OnOff %d\n", id, pid, onoff);
|
||||
return dib8000_write_word(st, 305 + id, onoff ? (1 << 13) | pid : 0);
|
||||
}
|
||||
|
||||
@@ -4431,7 +4438,7 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad
|
||||
struct dvb_frontend *fe;
|
||||
struct dib8000_state *state;
|
||||
|
||||
dprintk("dib8000_init");
|
||||
dprintk("dib8000_init\n");
|
||||
|
||||
state = kzalloc(sizeof(struct dib8000_state), GFP_KERNEL);
|
||||
if (state == NULL)
|
||||
|
@@ -7,6 +7,9 @@
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, version 2.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/mutex.h>
|
||||
@@ -21,7 +24,12 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiB9000: "); printk(args); printk("\n"); } } while (0)
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
#define MAX_NUMBER_OF_FRONTENDS 6
|
||||
|
||||
struct i2c_device {
|
||||
@@ -258,7 +266,7 @@ static int dib9000_read16_attr(struct dib9000_state *state, u16 reg, u8 *b, u32
|
||||
state->msg[1].buf = b;
|
||||
ret = i2c_transfer(state->i2c.i2c_adap, state->msg, 2) != 2 ? -EREMOTEIO : 0;
|
||||
if (ret != 0) {
|
||||
dprintk("i2c read error on %d", reg);
|
||||
dprintk("i2c read error on %d\n", reg);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
@@ -285,7 +293,7 @@ static u16 dib9000_i2c_read16(struct i2c_device *i2c, u16 reg)
|
||||
i2c->i2c_write_buffer[1] = reg & 0xff;
|
||||
|
||||
if (i2c_transfer(i2c->i2c_adap, msg, 2) != 2) {
|
||||
dprintk("read register %x error", reg);
|
||||
dprintk("read register %x error\n", reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -440,7 +448,7 @@ static int dib9000_risc_mem_read(struct dib9000_state *state, u8 cmd, u8 * b, u1
|
||||
return -EIO;
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
dib9000_risc_mem_setup(state, cmd | 0x80);
|
||||
@@ -456,7 +464,7 @@ static int dib9000_risc_mem_write(struct dib9000_state *state, u8 cmd, const u8
|
||||
return -EIO;
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
dib9000_risc_mem_setup(state, cmd);
|
||||
@@ -479,13 +487,13 @@ static int dib9000_firmware_download(struct dib9000_state *state, u8 risc_id, u1
|
||||
dib9000_write_word(state, 1025 + offs, 0);
|
||||
dib9000_write_word(state, 1031 + offs, key);
|
||||
|
||||
dprintk("going to download %dB of microcode", len);
|
||||
dprintk("going to download %dB of microcode\n", len);
|
||||
if (dib9000_write16_noinc(state, 1026 + offs, (u8 *) code, (u16) len) != 0) {
|
||||
dprintk("error while downloading microcode for RISC %c", 'A' + risc_id);
|
||||
dprintk("error while downloading microcode for RISC %c\n", 'A' + risc_id);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
dprintk("Microcode for RISC %c loaded", 'A' + risc_id);
|
||||
dprintk("Microcode for RISC %c loaded\n", 'A' + risc_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -511,10 +519,10 @@ static int dib9000_mbx_host_init(struct dib9000_state *state, u8 risc_id)
|
||||
} while ((reset_reg & 0x8000) && --tries);
|
||||
|
||||
if (reset_reg & 0x8000) {
|
||||
dprintk("MBX: init ERROR, no response from RISC %c", 'A' + risc_id);
|
||||
dprintk("MBX: init ERROR, no response from RISC %c\n", 'A' + risc_id);
|
||||
return -EIO;
|
||||
}
|
||||
dprintk("MBX: initialized");
|
||||
dprintk("MBX: initialized\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -531,30 +539,27 @@ static int dib9000_mbx_send_attr(struct dib9000_state *state, u8 id, u16 * data,
|
||||
return -EINVAL;
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mbx_if_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
tmp = MAX_MAILBOX_TRY;
|
||||
do {
|
||||
size = dib9000_read_word_attr(state, 1043, attr) & 0xff;
|
||||
if ((size + len + 1) > MBX_MAX_WORDS && --tmp) {
|
||||
dprintk("MBX: RISC mbx full, retrying");
|
||||
dprintk("MBX: RISC mbx full, retrying\n");
|
||||
msleep(100);
|
||||
} else
|
||||
break;
|
||||
} while (1);
|
||||
|
||||
/*dprintk( "MBX: size: %d", size); */
|
||||
/*dprintk( "MBX: size: %d\n", size); */
|
||||
|
||||
if (tmp == 0) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
#ifdef DUMP_MSG
|
||||
dprintk("--> %02x %d ", id, len + 1);
|
||||
for (i = 0; i < len; i++)
|
||||
dprintk("%04x ", data[i]);
|
||||
dprintk("\n");
|
||||
dprintk("--> %02x %d %*ph\n", id, len + 1, len, data);
|
||||
#endif
|
||||
|
||||
/* byte-order conversion - works on big (where it is not necessary) or little endian */
|
||||
@@ -596,7 +601,7 @@ static u8 dib9000_mbx_read(struct dib9000_state *state, u16 * data, u8 risc_id,
|
||||
return 0;
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mbx_if_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return 0;
|
||||
}
|
||||
if (risc_id == 1)
|
||||
@@ -622,13 +627,13 @@ static u8 dib9000_mbx_read(struct dib9000_state *state, u16 * data, u8 risc_id,
|
||||
}
|
||||
|
||||
#ifdef DUMP_MSG
|
||||
dprintk("<-- ");
|
||||
dprintk("<--\n");
|
||||
for (i = 0; i < size + 1; i++)
|
||||
dprintk("%04x ", d[i]);
|
||||
dprintk("%04x\n", d[i]);
|
||||
dprintk("\n");
|
||||
#endif
|
||||
} else {
|
||||
dprintk("MBX: message is too big for message cache (%d), flushing message", size);
|
||||
dprintk("MBX: message is too big for message cache (%d), flushing message\n", size);
|
||||
size--; /* Initial word already read */
|
||||
while (size--)
|
||||
dib9000_read16_noinc_attr(state, 1029 + mc_base, (u8 *) data, 2, attr);
|
||||
@@ -649,9 +654,11 @@ static int dib9000_risc_debug_buf(struct dib9000_state *state, u16 * data, u8 si
|
||||
b[2 * (size - 2) - 1] = '\0'; /* Bullet proof the buffer */
|
||||
if (*b == '~') {
|
||||
b++;
|
||||
dprintk("%s", b);
|
||||
dprintk("%s\n", b);
|
||||
} else
|
||||
dprintk("RISC%d: %d.%04d %s", state->fe_id, ts / 10000, ts % 10000, *b ? b : "<empty>");
|
||||
dprintk("RISC%d: %d.%04d %s\n",
|
||||
state->fe_id,
|
||||
ts / 10000, ts % 10000, *b ? b : "<empty>");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -666,7 +673,7 @@ static int dib9000_mbx_fetch_to_cache(struct dib9000_state *state, u16 attr)
|
||||
if (*block == 0) {
|
||||
size = dib9000_mbx_read(state, block, 1, attr);
|
||||
|
||||
/* dprintk( "MBX: fetched %04x message to cache", *block); */
|
||||
/* dprintk( "MBX: fetched %04x message to cache\n", *block); */
|
||||
|
||||
switch (*block >> 8) {
|
||||
case IN_MSG_DEBUG_BUF:
|
||||
@@ -686,7 +693,7 @@ static int dib9000_mbx_fetch_to_cache(struct dib9000_state *state, u16 attr)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
dprintk("MBX: no free cache-slot found for new message...");
|
||||
dprintk("MBX: no free cache-slot found for new message...\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -706,7 +713,7 @@ static int dib9000_mbx_process(struct dib9000_state *state, u16 attr)
|
||||
return -1;
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mbx_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -715,7 +722,7 @@ static int dib9000_mbx_process(struct dib9000_state *state, u16 attr)
|
||||
|
||||
dib9000_read_word_attr(state, 1229, attr); /* Clear the IRQ */
|
||||
/* if (tmp) */
|
||||
/* dprintk( "cleared IRQ: %x", tmp); */
|
||||
/* dprintk( "cleared IRQ: %x\n", tmp); */
|
||||
mutex_unlock(&state->platform.risc.mbx_lock);
|
||||
|
||||
return ret;
|
||||
@@ -750,7 +757,7 @@ static int dib9000_mbx_get_message_attr(struct dib9000_state *state, u16 id, u16
|
||||
} while (--timeout);
|
||||
|
||||
if (timeout == 0) {
|
||||
dprintk("waiting for message %d timed out", id);
|
||||
dprintk("waiting for message %d timed out\n", id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -770,7 +777,7 @@ static int dib9000_risc_check_version(struct dib9000_state *state)
|
||||
return -EIO;
|
||||
|
||||
fw_version = (r[0] << 8) | r[1];
|
||||
dprintk("RISC: ver: %d.%02d (IC: %d)", fw_version >> 10, fw_version & 0x3ff, (r[2] << 8) | r[3]);
|
||||
dprintk("RISC: ver: %d.%02d (IC: %d)\n", fw_version >> 10, fw_version & 0x3ff, (r[2] << 8) | r[3]);
|
||||
|
||||
if ((fw_version >> 10) != 7)
|
||||
return -EINVAL;
|
||||
@@ -850,40 +857,40 @@ static u16 dib9000_identify(struct i2c_device *client)
|
||||
|
||||
value = dib9000_i2c_read16(client, 896);
|
||||
if (value != 0x01b3) {
|
||||
dprintk("wrong Vendor ID (0x%x)", value);
|
||||
dprintk("wrong Vendor ID (0x%x)\n", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
value = dib9000_i2c_read16(client, 897);
|
||||
if (value != 0x4000 && value != 0x4001 && value != 0x4002 && value != 0x4003 && value != 0x4004 && value != 0x4005) {
|
||||
dprintk("wrong Device ID (0x%x)", value);
|
||||
dprintk("wrong Device ID (0x%x)\n", value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* protect this driver to be used with 7000PC */
|
||||
if (value == 0x4000 && dib9000_i2c_read16(client, 769) == 0x4000) {
|
||||
dprintk("this driver does not work with DiB7000PC");
|
||||
dprintk("this driver does not work with DiB7000PC\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (value) {
|
||||
case 0x4000:
|
||||
dprintk("found DiB7000MA/PA/MB/PB");
|
||||
dprintk("found DiB7000MA/PA/MB/PB\n");
|
||||
break;
|
||||
case 0x4001:
|
||||
dprintk("found DiB7000HC");
|
||||
dprintk("found DiB7000HC\n");
|
||||
break;
|
||||
case 0x4002:
|
||||
dprintk("found DiB7000MC");
|
||||
dprintk("found DiB7000MC\n");
|
||||
break;
|
||||
case 0x4003:
|
||||
dprintk("found DiB9000A");
|
||||
dprintk("found DiB9000A\n");
|
||||
break;
|
||||
case 0x4004:
|
||||
dprintk("found DiB9000H");
|
||||
dprintk("found DiB9000H\n");
|
||||
break;
|
||||
case 0x4005:
|
||||
dprintk("found DiB9000M");
|
||||
dprintk("found DiB9000M\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1020,7 @@ static int dib9000_risc_apb_access_read(struct dib9000_state *state, u32 address
|
||||
if (address >= 1024 || !state->platform.risc.fw_is_running)
|
||||
return -EINVAL;
|
||||
|
||||
/* dprintk( "APB access thru rd fw %d %x", address, attribute); */
|
||||
/* dprintk( "APB access thru rd fw %d %x\n", address, attribute); */
|
||||
|
||||
mb[0] = (u16) address;
|
||||
mb[1] = len / 2;
|
||||
@@ -1043,7 +1050,7 @@ static int dib9000_risc_apb_access_write(struct dib9000_state *state, u32 addres
|
||||
if (len > 18)
|
||||
return -EINVAL;
|
||||
|
||||
/* dprintk( "APB access thru wr fw %d %x", address, attribute); */
|
||||
/* dprintk( "APB access thru wr fw %d %x\n", address, attribute); */
|
||||
|
||||
mb[0] = (u16)address;
|
||||
for (i = 0; i + 1 < len; i += 2)
|
||||
@@ -1191,7 +1198,7 @@ static int dib9000_fw_get_channel(struct dvb_frontend *fe)
|
||||
int ret = 0;
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) {
|
||||
@@ -1534,7 +1541,7 @@ static int dib9000_fw_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
struct dib9000_state *state = fe->demodulator_priv;
|
||||
u16 outreg, smo_mode;
|
||||
|
||||
dprintk("setting output mode for demod %p to %d", fe, mode);
|
||||
dprintk("setting output mode for demod %p to %d\n", fe, mode);
|
||||
|
||||
switch (mode) {
|
||||
case OUTMODE_MPEG2_PAR_GATED_CLK:
|
||||
@@ -1556,7 +1563,7 @@ static int dib9000_fw_set_output_mode(struct dvb_frontend *fe, int mode)
|
||||
outreg = 0;
|
||||
break;
|
||||
default:
|
||||
dprintk("Unhandled output_mode passed to be set for demod %p", &state->fe[0]);
|
||||
dprintk("Unhandled output_mode passed to be set for demod %p\n", &state->fe[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1590,7 +1597,7 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[]
|
||||
len = 16;
|
||||
|
||||
if (dib9000_read_word(state, 790) != 0)
|
||||
dprintk("TunerITF: read busy");
|
||||
dprintk("TunerITF: read busy\n");
|
||||
|
||||
dib9000_write_word(state, 784, (u16) (msg[index_msg].addr));
|
||||
dib9000_write_word(state, 787, (len / 2) - 1);
|
||||
@@ -1601,7 +1608,7 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[]
|
||||
i--;
|
||||
|
||||
if (i == 0)
|
||||
dprintk("TunerITF: read failed");
|
||||
dprintk("TunerITF: read failed\n");
|
||||
|
||||
for (i = 0; i < len; i += 2) {
|
||||
t = dib9000_read_word(state, 785);
|
||||
@@ -1609,13 +1616,13 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[]
|
||||
msg[index_msg].buf[i + 1] = (t) & 0xff;
|
||||
}
|
||||
if (dib9000_read_word(state, 790) != 0)
|
||||
dprintk("TunerITF: read more data than expected");
|
||||
dprintk("TunerITF: read more data than expected\n");
|
||||
} else {
|
||||
i = 1000;
|
||||
while (dib9000_read_word(state, 789) && i)
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("TunerITF: write busy");
|
||||
dprintk("TunerITF: write busy\n");
|
||||
|
||||
len = msg[index_msg].len;
|
||||
if (len > 16)
|
||||
@@ -1631,7 +1638,7 @@ static int dib9000_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msg[]
|
||||
while (dib9000_read_word(state, 791) > 0 && i)
|
||||
i--;
|
||||
if (i == 0)
|
||||
dprintk("TunerITF: write failed");
|
||||
dprintk("TunerITF: write failed\n");
|
||||
}
|
||||
}
|
||||
return num;
|
||||
@@ -1676,7 +1683,7 @@ static int dib9000_fw_component_bus_xfer(struct i2c_adapter *i2c_adap, struct i2
|
||||
}
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1759,7 +1766,7 @@ static int dib9000_cfg_gpio(struct dib9000_state *st, u8 num, u8 dir, u8 val)
|
||||
st->gpio_val |= (val & 0x01) << num; /* set the new value */
|
||||
dib9000_write_word(st, 774, st->gpio_val);
|
||||
|
||||
dprintk("gpio dir: %04x: gpio val: %04x", st->gpio_dir, st->gpio_val);
|
||||
dprintk("gpio dir: %04x: gpio val: %04x\n", st->gpio_dir, st->gpio_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1779,7 +1786,7 @@ int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
|
||||
|
||||
if ((state->pid_ctrl_index != -2) && (state->pid_ctrl_index < 9)) {
|
||||
/* postpone the pid filtering cmd */
|
||||
dprintk("pid filter cmd postpone");
|
||||
dprintk("pid filter cmd postpone\n");
|
||||
state->pid_ctrl_index++;
|
||||
state->pid_ctrl[state->pid_ctrl_index].cmd = DIB9000_PID_FILTER_CTRL;
|
||||
state->pid_ctrl[state->pid_ctrl_index].onoff = onoff;
|
||||
@@ -1787,14 +1794,14 @@ int dib9000_fw_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff)
|
||||
}
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
|
||||
val = dib9000_read_word(state, 294 + 1) & 0xffef;
|
||||
val |= (onoff & 0x1) << 4;
|
||||
|
||||
dprintk("PID filter enabled %d", onoff);
|
||||
dprintk("PID filter enabled %d\n", onoff);
|
||||
ret = dib9000_write_word(state, 294 + 1, val);
|
||||
mutex_unlock(&state->demod_lock);
|
||||
return ret;
|
||||
@@ -1809,7 +1816,7 @@ int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
|
||||
|
||||
if (state->pid_ctrl_index != -2) {
|
||||
/* postpone the pid filtering cmd */
|
||||
dprintk("pid filter postpone");
|
||||
dprintk("pid filter postpone\n");
|
||||
if (state->pid_ctrl_index < 9) {
|
||||
state->pid_ctrl_index++;
|
||||
state->pid_ctrl[state->pid_ctrl_index].cmd = DIB9000_PID_FILTER;
|
||||
@@ -1817,15 +1824,15 @@ int dib9000_fw_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff)
|
||||
state->pid_ctrl[state->pid_ctrl_index].pid = pid;
|
||||
state->pid_ctrl[state->pid_ctrl_index].onoff = onoff;
|
||||
} else
|
||||
dprintk("can not add any more pid ctrl cmd");
|
||||
dprintk("can not add any more pid ctrl cmd\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
dprintk("Index %x, PID %d, OnOff %d", id, pid, onoff);
|
||||
dprintk("Index %x, PID %d, OnOff %d\n", id, pid, onoff);
|
||||
ret = dib9000_write_word(state, 300 + 1 + id,
|
||||
onoff ? (1 << 13) | pid : 0);
|
||||
mutex_unlock(&state->demod_lock);
|
||||
@@ -1868,7 +1875,7 @@ static int dib9000_sleep(struct dvb_frontend *fe)
|
||||
int ret = 0;
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) {
|
||||
@@ -1899,7 +1906,7 @@ static int dib9000_get_frontend(struct dvb_frontend *fe,
|
||||
|
||||
if (state->get_frontend_internal == 0) {
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
}
|
||||
@@ -1907,7 +1914,7 @@ static int dib9000_get_frontend(struct dvb_frontend *fe,
|
||||
for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++) {
|
||||
state->fe[index_frontend]->ops.read_status(state->fe[index_frontend], &stat);
|
||||
if (stat & FE_HAS_SYNC) {
|
||||
dprintk("TPS lock on the slave%i", index_frontend);
|
||||
dprintk("TPS lock on the slave%i\n", index_frontend);
|
||||
|
||||
/* synchronize the cache with the other frontends */
|
||||
state->fe[index_frontend]->ops.get_frontend(state->fe[index_frontend], c);
|
||||
@@ -1995,18 +2002,18 @@ static int dib9000_set_frontend(struct dvb_frontend *fe)
|
||||
|
||||
/* check that the correct parameters are set */
|
||||
if (state->fe[0]->dtv_property_cache.frequency == 0) {
|
||||
dprintk("dib9000: must specify frequency ");
|
||||
dprintk("dib9000: must specify frequency\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (state->fe[0]->dtv_property_cache.bandwidth_hz == 0) {
|
||||
dprintk("dib9000: must specify bandwidth ");
|
||||
dprintk("dib9000: must specify bandwidth\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
state->pid_ctrl_index = -1; /* postpone the pid filtering cmd */
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2073,14 +2080,14 @@ static int dib9000_set_frontend(struct dvb_frontend *fe)
|
||||
|
||||
/* check the tune result */
|
||||
if (exit_condition == 1) { /* tune failed */
|
||||
dprintk("tune failed");
|
||||
dprintk("tune failed\n");
|
||||
mutex_unlock(&state->demod_lock);
|
||||
/* tune failed; put all the pid filtering cmd to junk */
|
||||
state->pid_ctrl_index = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
dprintk("tune success on frontend%i", index_frontend_success);
|
||||
dprintk("tune success on frontend%i\n", index_frontend_success);
|
||||
|
||||
/* synchronize all the channel cache */
|
||||
state->get_frontend_internal = 1;
|
||||
@@ -2169,7 +2176,7 @@ static int dib9000_read_status(struct dvb_frontend *fe, enum fe_status *stat)
|
||||
u16 lock = 0, lock_slave = 0;
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
for (index_frontend = 1; (index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL); index_frontend++)
|
||||
@@ -2202,11 +2209,11 @@ static int dib9000_read_ber(struct dvb_frontend *fe, u32 * ber)
|
||||
int ret = 0;
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
ret = -EINTR;
|
||||
goto error;
|
||||
}
|
||||
@@ -2237,7 +2244,7 @@ static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
|
||||
int ret = 0;
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
*strength = 0;
|
||||
@@ -2250,7 +2257,7 @@ static int dib9000_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
|
||||
}
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
ret = -EINTR;
|
||||
goto error;
|
||||
}
|
||||
@@ -2281,7 +2288,7 @@ static u32 dib9000_get_snr(struct dvb_frontend *fe)
|
||||
u16 val;
|
||||
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return 0;
|
||||
}
|
||||
if (dib9000_fw_memmbx_sync(state, FE_SYNC_CHANNEL) < 0) {
|
||||
@@ -2320,7 +2327,7 @@ static int dib9000_read_snr(struct dvb_frontend *fe, u16 * snr)
|
||||
u32 snr_master;
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
snr_master = dib9000_get_snr(fe);
|
||||
@@ -2345,11 +2352,11 @@ static int dib9000_read_unc_blocks(struct dvb_frontend *fe, u32 * unc)
|
||||
int ret = 0;
|
||||
|
||||
if (mutex_lock_interruptible(&state->demod_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
return -EINTR;
|
||||
}
|
||||
if (mutex_lock_interruptible(&state->platform.risc.mem_mbx_lock) < 0) {
|
||||
dprintk("could not get the lock");
|
||||
dprintk("could not get the lock\n");
|
||||
ret = -EINTR;
|
||||
goto error;
|
||||
}
|
||||
@@ -2376,12 +2383,12 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul
|
||||
|
||||
client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
|
||||
if (!client.i2c_write_buffer) {
|
||||
dprintk("%s: not enough memory", __func__);
|
||||
dprintk("%s: not enough memory\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
|
||||
if (!client.i2c_read_buffer) {
|
||||
dprintk("%s: not enough memory", __func__);
|
||||
dprintk("%s: not enough memory\n", __func__);
|
||||
ret = -ENOMEM;
|
||||
goto error_memory;
|
||||
}
|
||||
@@ -2408,7 +2415,7 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul
|
||||
if (dib9000_identify(&client) == 0) {
|
||||
client.i2c_addr = default_addr;
|
||||
if (dib9000_identify(&client) == 0) {
|
||||
dprintk("DiB9000 #%d: not identified", k);
|
||||
dprintk("DiB9000 #%d: not identified\n", k);
|
||||
ret = -EIO;
|
||||
goto error;
|
||||
}
|
||||
@@ -2417,7 +2424,7 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul
|
||||
dib9000_i2c_write16(&client, 1795, (1 << 10) | (4 << 6));
|
||||
dib9000_i2c_write16(&client, 1794, (new_addr << 2) | 2);
|
||||
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)", k, new_addr);
|
||||
dprintk("IC %d initialized (to i2c_address 0x%x)\n", k, new_addr);
|
||||
}
|
||||
|
||||
for (k = 0; k < no_of_demods; k++) {
|
||||
@@ -2445,12 +2452,12 @@ int dib9000_set_slave_frontend(struct dvb_frontend *fe, struct dvb_frontend *fe_
|
||||
while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL))
|
||||
index_frontend++;
|
||||
if (index_frontend < MAX_NUMBER_OF_FRONTENDS) {
|
||||
dprintk("set slave fe %p to index %i", fe_slave, index_frontend);
|
||||
dprintk("set slave fe %p to index %i\n", fe_slave, index_frontend);
|
||||
state->fe[index_frontend] = fe_slave;
|
||||
return 0;
|
||||
}
|
||||
|
||||
dprintk("too many slave frontend");
|
||||
dprintk("too many slave frontend\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
EXPORT_SYMBOL(dib9000_set_slave_frontend);
|
||||
@@ -2463,12 +2470,12 @@ int dib9000_remove_slave_frontend(struct dvb_frontend *fe)
|
||||
while ((index_frontend < MAX_NUMBER_OF_FRONTENDS) && (state->fe[index_frontend] != NULL))
|
||||
index_frontend++;
|
||||
if (index_frontend != 1) {
|
||||
dprintk("remove slave fe %p (index %i)", state->fe[index_frontend - 1], index_frontend - 1);
|
||||
dprintk("remove slave fe %p (index %i)\n", state->fe[index_frontend - 1], index_frontend - 1);
|
||||
state->fe[index_frontend] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
dprintk("no frontend to be removed");
|
||||
dprintk("no frontend to be removed\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
EXPORT_SYMBOL(dib9000_remove_slave_frontend);
|
||||
@@ -2483,7 +2490,7 @@ struct dvb_frontend *dib9000_get_slave_frontend(struct dvb_frontend *fe, int sla
|
||||
}
|
||||
EXPORT_SYMBOL(dib9000_get_slave_frontend);
|
||||
|
||||
static struct dvb_frontend_ops dib9000_ops;
|
||||
static const struct dvb_frontend_ops dib9000_ops;
|
||||
struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, const struct dib9000_config *cfg)
|
||||
{
|
||||
struct dvb_frontend *fe;
|
||||
@@ -2560,7 +2567,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(dib9000_attach);
|
||||
|
||||
static struct dvb_frontend_ops dib9000_ops = {
|
||||
static const struct dvb_frontend_ops dib9000_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "DiBcom 9000",
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/module.h>
|
||||
@@ -8,14 +10,18 @@ static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "turn on debugging (default: 0)");
|
||||
|
||||
#define dprintk(args...) do { if (debug) { printk(KERN_DEBUG "DiBX000: "); printk(args); printk("\n"); } } while (0)
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
static int dibx000_write_word(struct dibx000_i2c_master *mst, u16 reg, u16 val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -41,7 +47,7 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg)
|
||||
u16 ret;
|
||||
|
||||
if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -59,7 +65,7 @@ static u16 dibx000_read_word(struct dibx000_i2c_master *mst, u16 reg)
|
||||
mst->msg[1].len = 2;
|
||||
|
||||
if (i2c_transfer(mst->i2c_adap, mst->msg, 2) != 2)
|
||||
dprintk("i2c read error on %d", reg);
|
||||
dprintk("i2c read error on %d\n", reg);
|
||||
|
||||
ret = (mst->i2c_read_buffer[0] << 8) | mst->i2c_read_buffer[1];
|
||||
mutex_unlock(&mst->i2c_buffer_lock);
|
||||
@@ -192,7 +198,7 @@ static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst,
|
||||
enum dibx000_i2c_interface intf)
|
||||
{
|
||||
if (mst->device_rev > DIB3000MC && mst->selected_interface != intf) {
|
||||
dprintk("selecting interface: %d", intf);
|
||||
dprintk("selecting interface: %d\n", intf);
|
||||
mst->selected_interface = intf;
|
||||
return dibx000_write_word(mst, mst->base_reg + 4, intf);
|
||||
}
|
||||
@@ -290,7 +296,7 @@ static int dibx000_i2c_gated_gpio67_xfer(struct i2c_adapter *i2c_adap,
|
||||
dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_6_7);
|
||||
|
||||
if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -337,7 +343,7 @@ static int dibx000_i2c_gated_tuner_xfer(struct i2c_adapter *i2c_adap,
|
||||
dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_TUNER);
|
||||
|
||||
if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
memset(mst->msg, 0, sizeof(struct i2c_msg) * (2 + num));
|
||||
@@ -391,7 +397,7 @@ struct i2c_adapter *dibx000_get_i2c_adapter(struct dibx000_i2c_master *mst,
|
||||
i2c = &mst->master_i2c_adap_gpio67;
|
||||
break;
|
||||
default:
|
||||
printk(KERN_ERR "DiBX000: incorrect I2C interface selected\n");
|
||||
pr_err("incorrect I2C interface selected\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -434,7 +440,7 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev,
|
||||
|
||||
mutex_init(&mst->i2c_buffer_lock);
|
||||
if (mutex_lock_interruptible(&mst->i2c_buffer_lock) < 0) {
|
||||
dprintk("could not acquire lock");
|
||||
dprintk("could not acquire lock\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
memset(mst->msg, 0, sizeof(struct i2c_msg));
|
||||
@@ -456,29 +462,25 @@ int dibx000_init_i2c_master(struct dibx000_i2c_master *mst, u16 device_rev,
|
||||
if (i2c_adapter_init
|
||||
(&mst->gated_tuner_i2c_adap, &dibx000_i2c_gated_tuner_algo,
|
||||
"DiBX000 tuner I2C bus", mst) != 0)
|
||||
printk(KERN_ERR
|
||||
"DiBX000: could not initialize the tuner i2c_adapter\n");
|
||||
pr_err("could not initialize the tuner i2c_adapter\n");
|
||||
|
||||
mst->master_i2c_adap_gpio12.dev.parent = mst->i2c_adap->dev.parent;
|
||||
if (i2c_adapter_init
|
||||
(&mst->master_i2c_adap_gpio12, &dibx000_i2c_master_gpio12_xfer_algo,
|
||||
"DiBX000 master GPIO12 I2C bus", mst) != 0)
|
||||
printk(KERN_ERR
|
||||
"DiBX000: could not initialize the master i2c_adapter\n");
|
||||
pr_err("could not initialize the master i2c_adapter\n");
|
||||
|
||||
mst->master_i2c_adap_gpio34.dev.parent = mst->i2c_adap->dev.parent;
|
||||
if (i2c_adapter_init
|
||||
(&mst->master_i2c_adap_gpio34, &dibx000_i2c_master_gpio34_xfer_algo,
|
||||
"DiBX000 master GPIO34 I2C bus", mst) != 0)
|
||||
printk(KERN_ERR
|
||||
"DiBX000: could not initialize the master i2c_adapter\n");
|
||||
pr_err("could not initialize the master i2c_adapter\n");
|
||||
|
||||
mst->master_i2c_adap_gpio67.dev.parent = mst->i2c_adap->dev.parent;
|
||||
if (i2c_adapter_init
|
||||
(&mst->master_i2c_adap_gpio67, &dibx000_i2c_gated_gpio67_algo,
|
||||
"DiBX000 master GPIO67 I2C bus", mst) != 0)
|
||||
printk(KERN_ERR
|
||||
"DiBX000: could not initialize the master i2c_adapter\n");
|
||||
pr_err("could not initialize the master i2c_adapter\n");
|
||||
|
||||
/* initialize the i2c-master by closing the gate */
|
||||
dibx000_i2c_gate_ctrl(mst, mst->i2c_write_buffer, 0, 0);
|
||||
@@ -500,16 +502,6 @@ void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst)
|
||||
}
|
||||
EXPORT_SYMBOL(dibx000_exit_i2c_master);
|
||||
|
||||
|
||||
u32 systime(void)
|
||||
{
|
||||
struct timespec t;
|
||||
|
||||
t = current_kernel_time();
|
||||
return (t.tv_sec * 10000) + (t.tv_nsec / 100000);
|
||||
}
|
||||
EXPORT_SYMBOL(systime);
|
||||
|
||||
MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@posteo.de>");
|
||||
MODULE_DESCRIPTION("Common function the DiBcom demodulator family");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@@ -47,8 +47,6 @@ extern void dibx000_exit_i2c_master(struct dibx000_i2c_master *mst);
|
||||
extern void dibx000_reset_i2c_master(struct dibx000_i2c_master *mst);
|
||||
extern int dibx000_i2c_set_speed(struct i2c_adapter *i2c_adap, u16 speed);
|
||||
|
||||
extern u32 systime(void);
|
||||
|
||||
#define BAND_LBAND 0x01
|
||||
#define BAND_UHF 0x02
|
||||
#define BAND_VHF 0x04
|
||||
|
@@ -12264,7 +12264,7 @@ static void drx39xxj_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops drx39xxj_ops;
|
||||
static const struct dvb_frontend_ops drx39xxj_ops;
|
||||
|
||||
struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c)
|
||||
{
|
||||
@@ -12363,7 +12363,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(drx39xxj_attach);
|
||||
|
||||
static struct dvb_frontend_ops drx39xxj_ops = {
|
||||
static const struct dvb_frontend_ops drx39xxj_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Micronas DRX39xxj family Frontend",
|
||||
|
@@ -2912,7 +2912,7 @@ static void drxd_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops drxd_ops = {
|
||||
static const struct dvb_frontend_ops drxd_ops = {
|
||||
.delsys = { SYS_DVBT},
|
||||
.info = {
|
||||
.name = "Micronas DRXD DVB-T",
|
||||
|
@@ -6737,7 +6737,7 @@ static int drxk_get_tune_settings(struct dvb_frontend *fe,
|
||||
}
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops drxk_ops = {
|
||||
static const struct dvb_frontend_ops drxk_ops = {
|
||||
/* .delsys will be filled dynamically */
|
||||
.info = {
|
||||
.name = "DRXK",
|
||||
|
@@ -248,8 +248,8 @@ static int ds3000_writereg(struct ds3000_state *state, int reg, int data)
|
||||
|
||||
err = i2c_transfer(state->i2c, &msg, 1);
|
||||
if (err != 1) {
|
||||
printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x,"
|
||||
" value == 0x%02x)\n", __func__, err, reg, data);
|
||||
printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x, value == 0x%02x)\n",
|
||||
__func__, err, reg, data);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
|
||||
@@ -296,8 +296,8 @@ static int ds3000_writeFW(struct ds3000_state *state, int reg,
|
||||
|
||||
ret = i2c_transfer(state->i2c, &msg, 1);
|
||||
if (ret != 1) {
|
||||
printk(KERN_ERR "%s: write error(err == %i, "
|
||||
"reg == 0x%02x\n", __func__, ret, reg);
|
||||
printk(KERN_ERR "%s: write error(err == %i, reg == 0x%02x\n",
|
||||
__func__, ret, reg);
|
||||
ret = -EREMOTEIO;
|
||||
goto error;
|
||||
}
|
||||
@@ -364,8 +364,8 @@ static int ds3000_firmware_ondemand(struct dvb_frontend *fe)
|
||||
state->i2c->dev.parent);
|
||||
printk(KERN_INFO "%s: Waiting for firmware upload(2)...\n", __func__);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "%s: No firmware uploaded (timeout or file not "
|
||||
"found?)\n", __func__);
|
||||
printk(KERN_ERR "%s: No firmware uploaded (timeout or file not found?)\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -830,7 +830,7 @@ static void ds3000_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops ds3000_ops;
|
||||
static const struct dvb_frontend_ops ds3000_ops;
|
||||
|
||||
struct dvb_frontend *ds3000_attach(const struct ds3000_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -1104,7 +1104,7 @@ static int ds3000_initfe(struct dvb_frontend *fe)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops ds3000_ops = {
|
||||
static const struct dvb_frontend_ops ds3000_ops = {
|
||||
.delsys = { SYS_DVBS, SYS_DVBS2 },
|
||||
.info = {
|
||||
.name = "Montage Technology DS3000",
|
||||
@@ -1144,8 +1144,7 @@ static struct dvb_frontend_ops ds3000_ops = {
|
||||
module_param(debug, int, 0644);
|
||||
MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
|
||||
|
||||
MODULE_DESCRIPTION("DVB Frontend module for Montage Technology "
|
||||
"DS3000 hardware");
|
||||
MODULE_DESCRIPTION("DVB Frontend module for Montage Technology DS3000 hardware");
|
||||
MODULE_AUTHOR("Konstantin Dimitrov <kosio.dimitrov@gmail.com>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_FIRMWARE(DS3000_DEFAULT_FIRMWARE);
|
||||
|
@@ -18,6 +18,8 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/dvb/frontend.h>
|
||||
@@ -25,6 +27,9 @@
|
||||
|
||||
#include "dvb-pll.h"
|
||||
|
||||
#define dprintk(fmt, arg...) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg)
|
||||
|
||||
struct dvb_pll_priv {
|
||||
/* pll number */
|
||||
int nr;
|
||||
@@ -362,7 +367,7 @@ static void opera1_bw(struct dvb_frontend *fe, u8 *buf)
|
||||
|
||||
result = i2c_transfer(priv->i2c, &msg, 1);
|
||||
if (result != 1)
|
||||
printk(KERN_ERR "%s: i2c_transfer failed:%d",
|
||||
pr_err("%s: i2c_transfer failed:%d",
|
||||
__func__, result);
|
||||
|
||||
if (b_w <= 10000)
|
||||
@@ -432,7 +437,7 @@ static void samsung_dtos403ih102a_set(struct dvb_frontend *fe, u8 *buf)
|
||||
|
||||
result = i2c_transfer(priv->i2c, &msg, 1);
|
||||
if (result != 1)
|
||||
printk(KERN_ERR "%s: i2c_transfer failed:%d",
|
||||
pr_err("%s: i2c_transfer failed:%d",
|
||||
__func__, result);
|
||||
|
||||
buf[2] = 0x9e;
|
||||
@@ -578,7 +583,7 @@ static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf,
|
||||
}
|
||||
|
||||
if (debug)
|
||||
printk("pll: %s: freq=%d | i=%d/%d\n", desc->name,
|
||||
dprintk("pll: %s: freq=%d | i=%d/%d\n", desc->name,
|
||||
frequency, i, desc->count);
|
||||
if (i == desc->count)
|
||||
return -EINVAL;
|
||||
@@ -594,18 +599,17 @@ static int dvb_pll_configure(struct dvb_frontend *fe, u8 *buf,
|
||||
desc->set(fe, buf);
|
||||
|
||||
if (debug)
|
||||
printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
|
||||
dprintk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
|
||||
desc->name, div, buf[0], buf[1], buf[2], buf[3]);
|
||||
|
||||
// calculate the frequency we set it to
|
||||
return (div * desc->entries[i].stepsize) - desc->iffreq;
|
||||
}
|
||||
|
||||
static int dvb_pll_release(struct dvb_frontend *fe)
|
||||
static void dvb_pll_release(struct dvb_frontend *fe)
|
||||
{
|
||||
kfree(fe->tuner_priv);
|
||||
fe->tuner_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dvb_pll_sleep(struct dvb_frontend *fe)
|
||||
@@ -803,10 +807,10 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
|
||||
fe->tuner_priv = priv;
|
||||
|
||||
if ((debug) || (id[priv->nr] == pll_desc_id)) {
|
||||
printk("dvb-pll[%d]", priv->nr);
|
||||
dprintk("dvb-pll[%d]", priv->nr);
|
||||
if (i2c != NULL)
|
||||
printk(" %d-%04x", i2c_adapter_id(i2c), pll_addr);
|
||||
printk(": id# %d (%s) attached, %s\n", pll_desc_id, desc->name,
|
||||
pr_cont(" %d-%04x", i2c_adapter_id(i2c), pll_addr);
|
||||
pr_cont(": id# %d (%s) attached, %s\n", pll_desc_id, desc->name,
|
||||
id[priv->nr] == pll_desc_id ?
|
||||
"insmod option" : "autodetected");
|
||||
}
|
||||
|
@@ -119,7 +119,7 @@ static void dvb_dummy_fe_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops;
|
||||
static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops;
|
||||
|
||||
struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void)
|
||||
return &state->frontend;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops;
|
||||
static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops;
|
||||
|
||||
struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void)
|
||||
return &state->frontend;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops dvb_dummy_fe_qam_ops;
|
||||
static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops;
|
||||
|
||||
struct dvb_frontend *dvb_dummy_fe_qam_attach(void)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void)
|
||||
return &state->frontend;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = {
|
||||
static const struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Dummy DVB-T",
|
||||
@@ -201,7 +201,7 @@ static struct dvb_frontend_ops dvb_dummy_fe_ofdm_ops = {
|
||||
.read_ucblocks = dvb_dummy_fe_read_ucblocks,
|
||||
};
|
||||
|
||||
static struct dvb_frontend_ops dvb_dummy_fe_qam_ops = {
|
||||
static const struct dvb_frontend_ops dvb_dummy_fe_qam_ops = {
|
||||
.delsys = { SYS_DVBC_ANNEX_A },
|
||||
.info = {
|
||||
.name = "Dummy DVB-C",
|
||||
@@ -230,7 +230,7 @@ static struct dvb_frontend_ops dvb_dummy_fe_qam_ops = {
|
||||
.read_ucblocks = dvb_dummy_fe_read_ucblocks,
|
||||
};
|
||||
|
||||
static struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = {
|
||||
static const struct dvb_frontend_ops dvb_dummy_fe_qpsk_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "Dummy DVB-S",
|
||||
|
@@ -280,7 +280,7 @@ static void ec100_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops ec100_ops;
|
||||
static const struct dvb_frontend_ops ec100_ops;
|
||||
|
||||
struct dvb_frontend *ec100_attach(const struct ec100_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -315,7 +315,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(ec100_attach);
|
||||
|
||||
static struct dvb_frontend_ops ec100_ops = {
|
||||
static const struct dvb_frontend_ops ec100_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "E3C EC100 DVB-T",
|
||||
|
@@ -323,7 +323,7 @@ static void gp8psk_fe_release(struct dvb_frontend* fe)
|
||||
kfree(st);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops gp8psk_fe_ops;
|
||||
static const struct dvb_frontend_ops gp8psk_fe_ops;
|
||||
|
||||
struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops,
|
||||
void *priv, bool is_rev1)
|
||||
@@ -351,7 +351,7 @@ struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gp8psk_fe_attach);
|
||||
|
||||
static struct dvb_frontend_ops gp8psk_fe_ops = {
|
||||
static const struct dvb_frontend_ops gp8psk_fe_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "Genpix DVB-S",
|
||||
|
@@ -793,7 +793,7 @@ static void hd29l2_release(struct dvb_frontend *fe)
|
||||
kfree(priv);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops hd29l2_ops;
|
||||
static const struct dvb_frontend_ops hd29l2_ops;
|
||||
|
||||
struct dvb_frontend *hd29l2_attach(const struct hd29l2_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -828,7 +828,7 @@ err:
|
||||
}
|
||||
EXPORT_SYMBOL(hd29l2_attach);
|
||||
|
||||
static struct dvb_frontend_ops hd29l2_ops = {
|
||||
static const struct dvb_frontend_ops hd29l2_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "HDIC HD29L2 DMB-TH",
|
||||
|
@@ -434,14 +434,13 @@ static int helene_init(struct dvb_frontend *fe)
|
||||
return helene_leave_power_save(priv);
|
||||
}
|
||||
|
||||
static int helene_release(struct dvb_frontend *fe)
|
||||
static void helene_release(struct dvb_frontend *fe)
|
||||
{
|
||||
struct helene_priv *priv = fe->tuner_priv;
|
||||
|
||||
dev_dbg(&priv->i2c->dev, "%s()\n", __func__);
|
||||
kfree(fe->tuner_priv);
|
||||
fe->tuner_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int helene_sleep(struct dvb_frontend *fe)
|
||||
|
@@ -151,14 +151,13 @@ static int horus3a_init(struct dvb_frontend *fe)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int horus3a_release(struct dvb_frontend *fe)
|
||||
static void horus3a_release(struct dvb_frontend *fe)
|
||||
{
|
||||
struct horus3a_priv *priv = fe->tuner_priv;
|
||||
|
||||
dev_dbg(&priv->i2c->dev, "%s()\n", __func__);
|
||||
kfree(fe->tuner_priv);
|
||||
fe->tuner_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int horus3a_sleep(struct dvb_frontend *fe)
|
||||
|
@@ -348,11 +348,10 @@ static int itd1000_sleep(struct dvb_frontend *fe)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int itd1000_release(struct dvb_frontend *fe)
|
||||
static void itd1000_release(struct dvb_frontend *fe)
|
||||
{
|
||||
kfree(fe->tuner_priv);
|
||||
fe->tuner_priv = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dvb_tuner_ops itd1000_tuner_ops = {
|
||||
|
@@ -94,14 +94,13 @@ static int ix2505v_write(struct ix2505v_state *state, u8 buf[], u8 count)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ix2505v_release(struct dvb_frontend *fe)
|
||||
static void ix2505v_release(struct dvb_frontend *fe)
|
||||
{
|
||||
struct ix2505v_state *state = fe->tuner_priv;
|
||||
|
||||
fe->tuner_priv = NULL;
|
||||
kfree(state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -496,7 +496,7 @@ static void l64781_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops l64781_ops;
|
||||
static const struct dvb_frontend_ops l64781_ops;
|
||||
|
||||
struct dvb_frontend* l64781_attach(const struct l64781_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -571,7 +571,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops l64781_ops = {
|
||||
static const struct dvb_frontend_ops l64781_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "LSI L64781 DVB-T",
|
||||
|
@@ -1359,7 +1359,7 @@ static void lg216x_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops lg2160_ops = {
|
||||
static const struct dvb_frontend_ops lg2160_ops = {
|
||||
.delsys = { SYS_ATSCMH },
|
||||
.info = {
|
||||
.name = "LG Electronics LG2160 ATSC/MH Frontend",
|
||||
@@ -1387,7 +1387,7 @@ static struct dvb_frontend_ops lg2160_ops = {
|
||||
.release = lg216x_release,
|
||||
};
|
||||
|
||||
static struct dvb_frontend_ops lg2161_ops = {
|
||||
static const struct dvb_frontend_ops lg2161_ops = {
|
||||
.delsys = { SYS_ATSCMH },
|
||||
.info = {
|
||||
.name = "LG Electronics LG2161 ATSC/MH Frontend",
|
||||
|
@@ -1103,8 +1103,8 @@ static void lgdt3305_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops lgdt3304_ops;
|
||||
static struct dvb_frontend_ops lgdt3305_ops;
|
||||
static const struct dvb_frontend_ops lgdt3304_ops;
|
||||
static const struct dvb_frontend_ops lgdt3305_ops;
|
||||
|
||||
struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config,
|
||||
struct i2c_adapter *i2c_adap)
|
||||
@@ -1164,7 +1164,7 @@ fail:
|
||||
}
|
||||
EXPORT_SYMBOL(lgdt3305_attach);
|
||||
|
||||
static struct dvb_frontend_ops lgdt3304_ops = {
|
||||
static const struct dvb_frontend_ops lgdt3304_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "LG Electronics LGDT3304 VSB/QAM Frontend",
|
||||
@@ -1187,7 +1187,7 @@ static struct dvb_frontend_ops lgdt3304_ops = {
|
||||
.release = lgdt3305_release,
|
||||
};
|
||||
|
||||
static struct dvb_frontend_ops lgdt3305_ops = {
|
||||
static const struct dvb_frontend_ops lgdt3305_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "LG Electronics LGDT3305 VSB/QAM Frontend",
|
||||
|
@@ -1767,7 +1767,7 @@ static void lgdt3306a_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops lgdt3306a_ops;
|
||||
static const struct dvb_frontend_ops lgdt3306a_ops;
|
||||
|
||||
struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config,
|
||||
struct i2c_adapter *i2c_adap)
|
||||
@@ -2103,7 +2103,7 @@ static void lgdt3306a_DumpRegs(struct lgdt3306a_state *state)
|
||||
|
||||
|
||||
|
||||
static struct dvb_frontend_ops lgdt3306a_ops = {
|
||||
static const struct dvb_frontend_ops lgdt3306a_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "LG Electronics LGDT3306A VSB/QAM Frontend",
|
||||
|
@@ -405,8 +405,7 @@ static int lgdt330x_set_parameters(struct dvb_frontend *fe)
|
||||
return -1;
|
||||
}
|
||||
if (err < 0)
|
||||
printk(KERN_WARNING "lgdt330x: %s: error blasting "
|
||||
"bytes to lgdt3303 for modulation type(%d)\n",
|
||||
printk(KERN_WARNING "lgdt330x: %s: error blasting bytes to lgdt3303 for modulation type(%d)\n",
|
||||
__func__, p->modulation);
|
||||
|
||||
/*
|
||||
@@ -729,8 +728,8 @@ static void lgdt330x_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops lgdt3302_ops;
|
||||
static struct dvb_frontend_ops lgdt3303_ops;
|
||||
static const struct dvb_frontend_ops lgdt3302_ops;
|
||||
static const struct dvb_frontend_ops lgdt3303_ops;
|
||||
|
||||
struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -775,7 +774,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops lgdt3302_ops = {
|
||||
static const struct dvb_frontend_ops lgdt3302_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name= "LG Electronics LGDT3302 VSB/QAM Frontend",
|
||||
@@ -798,7 +797,7 @@ static struct dvb_frontend_ops lgdt3302_ops = {
|
||||
.release = lgdt330x_release,
|
||||
};
|
||||
|
||||
static struct dvb_frontend_ops lgdt3303_ops = {
|
||||
static const struct dvb_frontend_ops lgdt3303_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name= "LG Electronics LGDT3303 VSB/QAM Frontend",
|
||||
|
@@ -376,7 +376,7 @@ lgs8gl5_release(struct dvb_frontend *fe)
|
||||
}
|
||||
|
||||
|
||||
static struct dvb_frontend_ops lgs8gl5_ops;
|
||||
static const struct dvb_frontend_ops lgs8gl5_ops;
|
||||
|
||||
|
||||
struct dvb_frontend*
|
||||
@@ -412,7 +412,7 @@ error:
|
||||
EXPORT_SYMBOL(lgs8gl5_attach);
|
||||
|
||||
|
||||
static struct dvb_frontend_ops lgs8gl5_ops = {
|
||||
static const struct dvb_frontend_ops lgs8gl5_ops = {
|
||||
.delsys = { SYS_DTMB },
|
||||
.info = {
|
||||
.name = "Legend Silicon LGS-8GL5 DMB-TH",
|
||||
|
@@ -985,7 +985,7 @@ static int lgs8gxx_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
|
||||
return lgs8gxx_write_reg(priv, 0x01, 0);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops lgs8gxx_ops = {
|
||||
static const struct dvb_frontend_ops lgs8gxx_ops = {
|
||||
.delsys = { SYS_DTMB },
|
||||
.info = {
|
||||
.name = "Legend Silicon LGS8913/LGS8GXX DMB-TH",
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "m88ds3103_priv.h"
|
||||
|
||||
static struct dvb_frontend_ops m88ds3103_ops;
|
||||
static const struct dvb_frontend_ops m88ds3103_ops;
|
||||
|
||||
/* write single register with mask */
|
||||
static int m88ds3103_update_bits(struct m88ds3103_dev *dev,
|
||||
@@ -1295,7 +1295,7 @@ struct dvb_frontend *m88ds3103_attach(const struct m88ds3103_config *cfg,
|
||||
}
|
||||
EXPORT_SYMBOL(m88ds3103_attach);
|
||||
|
||||
static struct dvb_frontend_ops m88ds3103_ops = {
|
||||
static const struct dvb_frontend_ops m88ds3103_ops = {
|
||||
.delsys = {SYS_DVBS, SYS_DVBS2},
|
||||
.info = {
|
||||
.name = "Montage Technology M88DS3103",
|
||||
|
@@ -75,8 +75,8 @@ static int m88rs2000_writereg(struct m88rs2000_state *state,
|
||||
ret = i2c_transfer(state->i2c, &msg, 1);
|
||||
|
||||
if (ret != 1)
|
||||
deb_info("%s: writereg error (reg == 0x%02x, val == 0x%02x, "
|
||||
"ret == %i)\n", __func__, reg, data, ret);
|
||||
deb_info("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n",
|
||||
__func__, reg, data, ret);
|
||||
|
||||
return (ret != 1) ? -EREMOTEIO : 0;
|
||||
}
|
||||
@@ -618,10 +618,9 @@ static int m88rs2000_set_frontend(struct dvb_frontend *fe)
|
||||
state->no_lock_count = 0;
|
||||
|
||||
if (c->delivery_system != SYS_DVBS) {
|
||||
deb_info("%s: unsupported delivery "
|
||||
"system selected (%d)\n",
|
||||
__func__, c->delivery_system);
|
||||
return -EOPNOTSUPP;
|
||||
deb_info("%s: unsupported delivery system selected (%d)\n",
|
||||
__func__, c->delivery_system);
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/* Set Tuner */
|
||||
@@ -753,7 +752,7 @@ static void m88rs2000_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops m88rs2000_ops = {
|
||||
static const struct dvb_frontend_ops m88rs2000_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "M88RS2000 DVB-S",
|
||||
|
@@ -1816,7 +1816,7 @@ static enum dvbfe_algo mb86a16_frontend_algo(struct dvb_frontend *fe)
|
||||
return DVBFE_ALGO_CUSTOM;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops mb86a16_ops = {
|
||||
static const struct dvb_frontend_ops mb86a16_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "Fujitsu MB86A16 DVB-S",
|
||||
|
@@ -1967,6 +1967,7 @@ static int mb86a20s_read_status_and_stats(struct dvb_frontend *fe,
|
||||
if (status_nr < 0) {
|
||||
dev_err(&state->i2c->dev,
|
||||
"%s: Can't read frontend lock status\n", __func__);
|
||||
rc = status_nr;
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -2059,7 +2060,7 @@ static int mb86a20s_get_frontend_algo(struct dvb_frontend *fe)
|
||||
return DVBFE_ALGO_HW;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops mb86a20s_ops;
|
||||
static const struct dvb_frontend_ops mb86a20s_ops;
|
||||
|
||||
struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -2107,7 +2108,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(mb86a20s_attach);
|
||||
|
||||
static struct dvb_frontend_ops mb86a20s_ops = {
|
||||
static const struct dvb_frontend_ops mb86a20s_ops = {
|
||||
.delsys = { SYS_ISDBT },
|
||||
/* Use dib8000 values per default */
|
||||
.info = {
|
||||
|
@@ -411,7 +411,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops mn88472_ops = {
|
||||
static const struct dvb_frontend_ops mn88472_ops = {
|
||||
.delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A},
|
||||
.info = {
|
||||
.name = "Panasonic MN88472",
|
||||
@@ -488,18 +488,6 @@ static int mn88472_probe(struct i2c_client *client,
|
||||
goto err_kfree;
|
||||
}
|
||||
|
||||
/* Check demod answers with correct chip id */
|
||||
ret = regmap_read(dev->regmap[0], 0xff, &utmp);
|
||||
if (ret)
|
||||
goto err_regmap_0_regmap_exit;
|
||||
|
||||
dev_dbg(&client->dev, "chip id=%02x\n", utmp);
|
||||
|
||||
if (utmp != 0x02) {
|
||||
ret = -ENODEV;
|
||||
goto err_regmap_0_regmap_exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Chip has three I2C addresses for different register banks. Used
|
||||
* addresses are 0x18, 0x1a and 0x1c. We register two dummy clients,
|
||||
@@ -536,6 +524,18 @@ static int mn88472_probe(struct i2c_client *client,
|
||||
}
|
||||
i2c_set_clientdata(dev->client[2], dev);
|
||||
|
||||
/* Check demod answers with correct chip id */
|
||||
ret = regmap_read(dev->regmap[2], 0xff, &utmp);
|
||||
if (ret)
|
||||
goto err_regmap_2_regmap_exit;
|
||||
|
||||
dev_dbg(&client->dev, "chip id=%02x\n", utmp);
|
||||
|
||||
if (utmp != 0x02) {
|
||||
ret = -ENODEV;
|
||||
goto err_regmap_2_regmap_exit;
|
||||
}
|
||||
|
||||
/* Sleep because chip is active by default */
|
||||
ret = regmap_write(dev->regmap[2], 0x05, 0x3e);
|
||||
if (ret)
|
||||
|
@@ -239,62 +239,68 @@ static int mn88473_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
struct i2c_client *client = fe->demodulator_priv;
|
||||
struct mn88473_dev *dev = i2c_get_clientdata(client);
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
int ret;
|
||||
unsigned int uitmp;
|
||||
int ret, i, stmp;
|
||||
unsigned int utmp, utmp1, utmp2;
|
||||
u8 buf[5];
|
||||
|
||||
if (!dev->active) {
|
||||
ret = -EAGAIN;
|
||||
goto err;
|
||||
}
|
||||
|
||||
*status = 0;
|
||||
|
||||
/* Lock detection */
|
||||
switch (c->delivery_system) {
|
||||
case SYS_DVBT:
|
||||
ret = regmap_read(dev->regmap[0], 0x62, &uitmp);
|
||||
ret = regmap_read(dev->regmap[0], 0x62, &utmp);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (!(uitmp & 0xa0)) {
|
||||
if ((uitmp & 0x0f) >= 0x09)
|
||||
if (!(utmp & 0xa0)) {
|
||||
if ((utmp & 0x0f) >= 0x09)
|
||||
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
|
||||
FE_HAS_VITERBI | FE_HAS_SYNC |
|
||||
FE_HAS_LOCK;
|
||||
else if ((uitmp & 0x0f) >= 0x03)
|
||||
else if ((utmp & 0x0f) >= 0x03)
|
||||
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
|
||||
} else {
|
||||
*status = 0;
|
||||
}
|
||||
break;
|
||||
case SYS_DVBT2:
|
||||
ret = regmap_read(dev->regmap[2], 0x8b, &uitmp);
|
||||
ret = regmap_read(dev->regmap[2], 0x8b, &utmp);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (!(uitmp & 0x40)) {
|
||||
if ((uitmp & 0x0f) >= 0x0d)
|
||||
if (!(utmp & 0x40)) {
|
||||
if ((utmp & 0x0f) >= 0x0d)
|
||||
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
|
||||
FE_HAS_VITERBI | FE_HAS_SYNC |
|
||||
FE_HAS_LOCK;
|
||||
else if ((uitmp & 0x0f) >= 0x0a)
|
||||
else if ((utmp & 0x0f) >= 0x0a)
|
||||
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
|
||||
FE_HAS_VITERBI;
|
||||
else if ((uitmp & 0x0f) >= 0x07)
|
||||
else if ((utmp & 0x0f) >= 0x07)
|
||||
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
|
||||
} else {
|
||||
*status = 0;
|
||||
}
|
||||
break;
|
||||
case SYS_DVBC_ANNEX_A:
|
||||
ret = regmap_read(dev->regmap[1], 0x85, &uitmp);
|
||||
ret = regmap_read(dev->regmap[1], 0x85, &utmp);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (!(uitmp & 0x40)) {
|
||||
ret = regmap_read(dev->regmap[1], 0x89, &uitmp);
|
||||
if (!(utmp & 0x40)) {
|
||||
ret = regmap_read(dev->regmap[1], 0x89, &utmp);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (uitmp & 0x01)
|
||||
if (utmp & 0x01)
|
||||
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
|
||||
FE_HAS_VITERBI | FE_HAS_SYNC |
|
||||
FE_HAS_LOCK;
|
||||
FE_HAS_VITERBI | FE_HAS_SYNC |
|
||||
FE_HAS_LOCK;
|
||||
} else {
|
||||
*status = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -302,6 +308,148 @@ static int mn88473_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Signal strength */
|
||||
if (*status & FE_HAS_SIGNAL) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
ret = regmap_bulk_read(dev->regmap[2], 0x86 + i,
|
||||
&buf[i], 1);
|
||||
if (ret)
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* AGCRD[15:6] gives us a 10bit value ([5:0] are always 0) */
|
||||
utmp1 = buf[0] << 8 | buf[1] << 0 | buf[0] >> 2;
|
||||
dev_dbg(&client->dev, "strength=%u\n", utmp1);
|
||||
|
||||
c->strength.stat[0].scale = FE_SCALE_RELATIVE;
|
||||
c->strength.stat[0].uvalue = utmp1;
|
||||
} else {
|
||||
c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
/* CNR */
|
||||
if (*status & FE_HAS_VITERBI && c->delivery_system == SYS_DVBT) {
|
||||
/* DVB-T CNR */
|
||||
ret = regmap_bulk_read(dev->regmap[0], 0x8f, buf, 2);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
utmp = buf[0] << 8 | buf[1] << 0;
|
||||
if (utmp) {
|
||||
/* CNR[dB]: 10 * (log10(65536 / value) + 0.2) */
|
||||
/* log10(65536) = 80807124, 0.2 = 3355443 */
|
||||
stmp = div_u64(((u64)80807124 - intlog10(utmp)
|
||||
+ 3355443) * 10000, 1 << 24);
|
||||
dev_dbg(&client->dev, "cnr=%d value=%u\n", stmp, utmp);
|
||||
} else {
|
||||
stmp = 0;
|
||||
}
|
||||
|
||||
c->cnr.stat[0].svalue = stmp;
|
||||
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
|
||||
} else if (*status & FE_HAS_VITERBI &&
|
||||
c->delivery_system == SYS_DVBT2) {
|
||||
/* DVB-T2 CNR */
|
||||
for (i = 0; i < 3; i++) {
|
||||
ret = regmap_bulk_read(dev->regmap[2], 0xb7 + i,
|
||||
&buf[i], 1);
|
||||
if (ret)
|
||||
goto err;
|
||||
}
|
||||
|
||||
utmp = buf[1] << 8 | buf[2] << 0;
|
||||
utmp1 = (buf[0] >> 2) & 0x01; /* 0=SISO, 1=MISO */
|
||||
if (utmp) {
|
||||
if (utmp1) {
|
||||
/* CNR[dB]: 10 * (log10(16384 / value) - 0.6) */
|
||||
/* log10(16384) = 70706234, 0.6 = 10066330 */
|
||||
stmp = div_u64(((u64)70706234 - intlog10(utmp)
|
||||
- 10066330) * 10000, 1 << 24);
|
||||
dev_dbg(&client->dev, "cnr=%d value=%u MISO\n",
|
||||
stmp, utmp);
|
||||
} else {
|
||||
/* CNR[dB]: 10 * (log10(65536 / value) + 0.2) */
|
||||
/* log10(65536) = 80807124, 0.2 = 3355443 */
|
||||
stmp = div_u64(((u64)80807124 - intlog10(utmp)
|
||||
+ 3355443) * 10000, 1 << 24);
|
||||
dev_dbg(&client->dev, "cnr=%d value=%u SISO\n",
|
||||
stmp, utmp);
|
||||
}
|
||||
} else {
|
||||
stmp = 0;
|
||||
}
|
||||
|
||||
c->cnr.stat[0].svalue = stmp;
|
||||
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
|
||||
} else if (*status & FE_HAS_VITERBI &&
|
||||
c->delivery_system == SYS_DVBC_ANNEX_A) {
|
||||
/* DVB-C CNR */
|
||||
ret = regmap_bulk_read(dev->regmap[1], 0xa1, buf, 4);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
utmp1 = buf[0] << 8 | buf[1] << 0; /* signal */
|
||||
utmp2 = buf[2] << 8 | buf[3] << 0; /* noise */
|
||||
if (utmp1 && utmp2) {
|
||||
/* CNR[dB]: 10 * log10(8 * (signal / noise)) */
|
||||
/* log10(8) = 15151336 */
|
||||
stmp = div_u64(((u64)15151336 + intlog10(utmp1)
|
||||
- intlog10(utmp2)) * 10000, 1 << 24);
|
||||
dev_dbg(&client->dev, "cnr=%d signal=%u noise=%u\n",
|
||||
stmp, utmp1, utmp2);
|
||||
} else {
|
||||
stmp = 0;
|
||||
}
|
||||
|
||||
c->cnr.stat[0].svalue = stmp;
|
||||
c->cnr.stat[0].scale = FE_SCALE_DECIBEL;
|
||||
} else {
|
||||
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
/* BER */
|
||||
if (*status & FE_HAS_LOCK && (c->delivery_system == SYS_DVBT ||
|
||||
c->delivery_system == SYS_DVBC_ANNEX_A)) {
|
||||
/* DVB-T & DVB-C BER */
|
||||
ret = regmap_bulk_read(dev->regmap[0], 0x92, buf, 5);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
utmp1 = buf[0] << 16 | buf[1] << 8 | buf[2] << 0;
|
||||
utmp2 = buf[3] << 8 | buf[4] << 0;
|
||||
utmp2 = utmp2 * 8 * 204;
|
||||
dev_dbg(&client->dev, "post_bit_error=%u post_bit_count=%u\n",
|
||||
utmp1, utmp2);
|
||||
|
||||
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
|
||||
c->post_bit_error.stat[0].uvalue += utmp1;
|
||||
c->post_bit_count.stat[0].scale = FE_SCALE_COUNTER;
|
||||
c->post_bit_count.stat[0].uvalue += utmp2;
|
||||
} else {
|
||||
c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
/* PER */
|
||||
if (*status & FE_HAS_LOCK) {
|
||||
ret = regmap_bulk_read(dev->regmap[0], 0xdd, buf, 4);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
utmp1 = buf[0] << 8 | buf[1] << 0;
|
||||
utmp2 = buf[2] << 8 | buf[3] << 0;
|
||||
dev_dbg(&client->dev, "block_error=%u block_count=%u\n",
|
||||
utmp1, utmp2);
|
||||
|
||||
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
|
||||
c->block_error.stat[0].uvalue += utmp1;
|
||||
c->block_count.stat[0].scale = FE_SCALE_COUNTER;
|
||||
c->block_count.stat[0].uvalue += utmp2;
|
||||
} else {
|
||||
c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
err:
|
||||
dev_dbg(&client->dev, "failed=%d\n", ret);
|
||||
@@ -312,6 +460,7 @@ static int mn88473_init(struct dvb_frontend *fe)
|
||||
{
|
||||
struct i2c_client *client = fe->demodulator_priv;
|
||||
struct mn88473_dev *dev = i2c_get_clientdata(client);
|
||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||
int ret, len, remain;
|
||||
unsigned int uitmp;
|
||||
const struct firmware *fw;
|
||||
@@ -378,6 +527,20 @@ warm:
|
||||
|
||||
dev->active = true;
|
||||
|
||||
/* init stats here to indicate which stats are supported */
|
||||
c->strength.len = 1;
|
||||
c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
c->cnr.len = 1;
|
||||
c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
c->post_bit_error.len = 1;
|
||||
c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
c->post_bit_count.len = 1;
|
||||
c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
c->block_error.len = 1;
|
||||
c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
c->block_count.len = 1;
|
||||
c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
|
||||
|
||||
return 0;
|
||||
err_release_firmware:
|
||||
release_firmware(fw);
|
||||
@@ -485,18 +648,6 @@ static int mn88473_probe(struct i2c_client *client,
|
||||
goto err_kfree;
|
||||
}
|
||||
|
||||
/* Check demod answers with correct chip id */
|
||||
ret = regmap_read(dev->regmap[0], 0xff, &uitmp);
|
||||
if (ret)
|
||||
goto err_regmap_0_regmap_exit;
|
||||
|
||||
dev_dbg(&client->dev, "chip id=%02x\n", uitmp);
|
||||
|
||||
if (uitmp != 0x03) {
|
||||
ret = -ENODEV;
|
||||
goto err_regmap_0_regmap_exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Chip has three I2C addresses for different register banks. Used
|
||||
* addresses are 0x18, 0x1a and 0x1c. We register two dummy clients,
|
||||
@@ -533,6 +684,18 @@ static int mn88473_probe(struct i2c_client *client,
|
||||
}
|
||||
i2c_set_clientdata(dev->client[2], dev);
|
||||
|
||||
/* Check demod answers with correct chip id */
|
||||
ret = regmap_read(dev->regmap[2], 0xff, &uitmp);
|
||||
if (ret)
|
||||
goto err_regmap_2_regmap_exit;
|
||||
|
||||
dev_dbg(&client->dev, "chip id=%02x\n", uitmp);
|
||||
|
||||
if (uitmp != 0x03) {
|
||||
ret = -ENODEV;
|
||||
goto err_regmap_2_regmap_exit;
|
||||
}
|
||||
|
||||
/* Sleep because chip is active by default */
|
||||
ret = regmap_write(dev->regmap[2], 0x05, 0x3e);
|
||||
if (ret)
|
||||
|
@@ -18,7 +18,9 @@
|
||||
#define MN88473_PRIV_H
|
||||
|
||||
#include "dvb_frontend.h"
|
||||
#include "dvb_math.h"
|
||||
#include "mn88473.h"
|
||||
#include <linux/math64.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
|
@@ -457,8 +457,8 @@ static int mt312_read_status(struct dvb_frontend *fe, enum fe_status *s)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dprintk("QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x,"
|
||||
" FEC_STATUS: 0x%02x\n", status[0], status[1], status[2]);
|
||||
dprintk("QPSK_STAT_H: 0x%02x, QPSK_STAT_L: 0x%02x, FEC_STATUS: 0x%02x\n",
|
||||
status[0], status[1], status[2]);
|
||||
|
||||
if (status[0] & 0xc0)
|
||||
*s |= FE_HAS_SIGNAL; /* signal noise ratio */
|
||||
@@ -748,7 +748,7 @@ static void mt312_release(struct dvb_frontend *fe)
|
||||
}
|
||||
|
||||
#define MT312_SYS_CLK 90000000UL /* 90 MHz */
|
||||
static struct dvb_frontend_ops mt312_ops = {
|
||||
static const struct dvb_frontend_ops mt312_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "Zarlink ???? DVB-S",
|
||||
@@ -827,8 +827,7 @@ struct dvb_frontend *mt312_attach(const struct mt312_config *config,
|
||||
state->freq_mult = 9;
|
||||
break;
|
||||
default:
|
||||
printk(KERN_WARNING "Only Zarlink VP310/MT312/ZL10313"
|
||||
" are supported chips.\n");
|
||||
printk(KERN_WARNING "Only Zarlink VP310/MT312/ZL10313 are supported chips.\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@@ -538,7 +538,7 @@ static void mt352_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops mt352_ops;
|
||||
static const struct dvb_frontend_ops mt352_ops;
|
||||
|
||||
struct dvb_frontend* mt352_attach(const struct mt352_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -566,7 +566,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops mt352_ops = {
|
||||
static const struct dvb_frontend_ops mt352_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Zarlink MT352 DVB-T",
|
||||
|
@@ -289,8 +289,7 @@ static void nxt200x_microcontroller_stop (struct nxt200x_state* state)
|
||||
counter++;
|
||||
}
|
||||
|
||||
pr_warn("Timeout waiting for nxt200x to stop. This is ok after "
|
||||
"firmware upload.\n");
|
||||
pr_warn("Timeout waiting for nxt200x to stop. This is ok after firmware upload.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -893,8 +892,8 @@ static int nxt2002_init(struct dvb_frontend* fe)
|
||||
state->i2c->dev.parent);
|
||||
pr_debug("%s: Waiting for firmware upload(2)...\n", __func__);
|
||||
if (ret) {
|
||||
pr_err("%s: No firmware uploaded (timeout or file not found?)"
|
||||
"\n", __func__);
|
||||
pr_err("%s: No firmware uploaded (timeout or file not found?)\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -960,8 +959,8 @@ static int nxt2004_init(struct dvb_frontend* fe)
|
||||
state->i2c->dev.parent);
|
||||
pr_debug("%s: Waiting for firmware upload(2)...\n", __func__);
|
||||
if (ret) {
|
||||
pr_err("%s: No firmware uploaded (timeout or file not found?)"
|
||||
"\n", __func__);
|
||||
pr_err("%s: No firmware uploaded (timeout or file not found?)\n",
|
||||
__func__);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1150,7 +1149,7 @@ static void nxt200x_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops nxt200x_ops;
|
||||
static const struct dvb_frontend_ops nxt200x_ops;
|
||||
|
||||
struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -1213,7 +1212,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops nxt200x_ops = {
|
||||
static const struct dvb_frontend_ops nxt200x_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Nextwave NXT200X VSB/QAM frontend",
|
||||
|
@@ -19,6 +19,8 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
@@ -39,7 +41,11 @@ struct nxt6000_state {
|
||||
};
|
||||
|
||||
static int debug;
|
||||
#define dprintk if (debug) printk
|
||||
#define dprintk(fmt, arg...) do { \
|
||||
if (debug) \
|
||||
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
|
||||
__func__, ##arg); \
|
||||
} while (0)
|
||||
|
||||
static int nxt6000_writereg(struct nxt6000_state* state, u8 reg, u8 data)
|
||||
{
|
||||
@@ -215,119 +221,129 @@ static void nxt6000_dump_status(struct nxt6000_state *state)
|
||||
{
|
||||
u8 val;
|
||||
|
||||
/*
|
||||
printk("RS_COR_STAT: 0x%02X\n", nxt6000_readreg(fe, RS_COR_STAT));
|
||||
printk("VIT_SYNC_STATUS: 0x%02X\n", nxt6000_readreg(fe, VIT_SYNC_STATUS));
|
||||
printk("OFDM_COR_STAT: 0x%02X\n", nxt6000_readreg(fe, OFDM_COR_STAT));
|
||||
printk("OFDM_SYR_STAT: 0x%02X\n", nxt6000_readreg(fe, OFDM_SYR_STAT));
|
||||
printk("OFDM_TPS_RCVD_1: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_1));
|
||||
printk("OFDM_TPS_RCVD_2: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_2));
|
||||
printk("OFDM_TPS_RCVD_3: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_3));
|
||||
printk("OFDM_TPS_RCVD_4: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RCVD_4));
|
||||
printk("OFDM_TPS_RESERVED_1: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RESERVED_1));
|
||||
printk("OFDM_TPS_RESERVED_2: 0x%02X\n", nxt6000_readreg(fe, OFDM_TPS_RESERVED_2));
|
||||
*/
|
||||
printk("NXT6000 status:");
|
||||
#if 0
|
||||
pr_info("RS_COR_STAT: 0x%02X\n",
|
||||
nxt6000_readreg(fe, RS_COR_STAT));
|
||||
pr_info("VIT_SYNC_STATUS: 0x%02X\n",
|
||||
nxt6000_readreg(fe, VIT_SYNC_STATUS));
|
||||
pr_info("OFDM_COR_STAT: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_COR_STAT));
|
||||
pr_info("OFDM_SYR_STAT: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_SYR_STAT));
|
||||
pr_info("OFDM_TPS_RCVD_1: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_TPS_RCVD_1));
|
||||
pr_info("OFDM_TPS_RCVD_2: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_TPS_RCVD_2));
|
||||
pr_info("OFDM_TPS_RCVD_3: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_TPS_RCVD_3));
|
||||
pr_info("OFDM_TPS_RCVD_4: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_TPS_RCVD_4));
|
||||
pr_info("OFDM_TPS_RESERVED_1: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_TPS_RESERVED_1));
|
||||
pr_info("OFDM_TPS_RESERVED_2: 0x%02X\n",
|
||||
nxt6000_readreg(fe, OFDM_TPS_RESERVED_2));
|
||||
#endif
|
||||
pr_info("NXT6000 status:");
|
||||
|
||||
val = nxt6000_readreg(state, RS_COR_STAT);
|
||||
|
||||
printk(" DATA DESCR LOCK: %d,", val & 0x01);
|
||||
printk(" DATA SYNC LOCK: %d,", (val >> 1) & 0x01);
|
||||
pr_cont(" DATA DESCR LOCK: %d,", val & 0x01);
|
||||
pr_cont(" DATA SYNC LOCK: %d,", (val >> 1) & 0x01);
|
||||
|
||||
val = nxt6000_readreg(state, VIT_SYNC_STATUS);
|
||||
|
||||
printk(" VITERBI LOCK: %d,", (val >> 7) & 0x01);
|
||||
pr_cont(" VITERBI LOCK: %d,", (val >> 7) & 0x01);
|
||||
|
||||
switch ((val >> 4) & 0x07) {
|
||||
|
||||
case 0x00:
|
||||
printk(" VITERBI CODERATE: 1/2,");
|
||||
pr_cont(" VITERBI CODERATE: 1/2,");
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
printk(" VITERBI CODERATE: 2/3,");
|
||||
pr_cont(" VITERBI CODERATE: 2/3,");
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
printk(" VITERBI CODERATE: 3/4,");
|
||||
pr_cont(" VITERBI CODERATE: 3/4,");
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
printk(" VITERBI CODERATE: 5/6,");
|
||||
pr_cont(" VITERBI CODERATE: 5/6,");
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
printk(" VITERBI CODERATE: 7/8,");
|
||||
pr_cont(" VITERBI CODERATE: 7/8,");
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(" VITERBI CODERATE: Reserved,");
|
||||
pr_cont(" VITERBI CODERATE: Reserved,");
|
||||
|
||||
}
|
||||
|
||||
val = nxt6000_readreg(state, OFDM_COR_STAT);
|
||||
|
||||
printk(" CHCTrack: %d,", (val >> 7) & 0x01);
|
||||
printk(" TPSLock: %d,", (val >> 6) & 0x01);
|
||||
printk(" SYRLock: %d,", (val >> 5) & 0x01);
|
||||
printk(" AGCLock: %d,", (val >> 4) & 0x01);
|
||||
pr_cont(" CHCTrack: %d,", (val >> 7) & 0x01);
|
||||
pr_cont(" TPSLock: %d,", (val >> 6) & 0x01);
|
||||
pr_cont(" SYRLock: %d,", (val >> 5) & 0x01);
|
||||
pr_cont(" AGCLock: %d,", (val >> 4) & 0x01);
|
||||
|
||||
switch (val & 0x0F) {
|
||||
|
||||
case 0x00:
|
||||
printk(" CoreState: IDLE,");
|
||||
pr_cont(" CoreState: IDLE,");
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
printk(" CoreState: WAIT_AGC,");
|
||||
pr_cont(" CoreState: WAIT_AGC,");
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
printk(" CoreState: WAIT_SYR,");
|
||||
pr_cont(" CoreState: WAIT_SYR,");
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
printk(" CoreState: WAIT_PPM,");
|
||||
pr_cont(" CoreState: WAIT_PPM,");
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
printk(" CoreState: WAIT_TRL,");
|
||||
pr_cont(" CoreState: WAIT_TRL,");
|
||||
break;
|
||||
|
||||
case 0x05:
|
||||
printk(" CoreState: WAIT_TPS,");
|
||||
pr_cont(" CoreState: WAIT_TPS,");
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
printk(" CoreState: MONITOR_TPS,");
|
||||
pr_cont(" CoreState: MONITOR_TPS,");
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(" CoreState: Reserved,");
|
||||
pr_cont(" CoreState: Reserved,");
|
||||
|
||||
}
|
||||
|
||||
val = nxt6000_readreg(state, OFDM_SYR_STAT);
|
||||
|
||||
printk(" SYRLock: %d,", (val >> 4) & 0x01);
|
||||
printk(" SYRMode: %s,", (val >> 2) & 0x01 ? "8K" : "2K");
|
||||
pr_cont(" SYRLock: %d,", (val >> 4) & 0x01);
|
||||
pr_cont(" SYRMode: %s,", (val >> 2) & 0x01 ? "8K" : "2K");
|
||||
|
||||
switch ((val >> 4) & 0x03) {
|
||||
|
||||
case 0x00:
|
||||
printk(" SYRGuard: 1/32,");
|
||||
pr_cont(" SYRGuard: 1/32,");
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
printk(" SYRGuard: 1/16,");
|
||||
pr_cont(" SYRGuard: 1/16,");
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
printk(" SYRGuard: 1/8,");
|
||||
pr_cont(" SYRGuard: 1/8,");
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
printk(" SYRGuard: 1/4,");
|
||||
pr_cont(" SYRGuard: 1/4,");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -336,77 +352,77 @@ static void nxt6000_dump_status(struct nxt6000_state *state)
|
||||
switch ((val >> 4) & 0x07) {
|
||||
|
||||
case 0x00:
|
||||
printk(" TPSLP: 1/2,");
|
||||
pr_cont(" TPSLP: 1/2,");
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
printk(" TPSLP: 2/3,");
|
||||
pr_cont(" TPSLP: 2/3,");
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
printk(" TPSLP: 3/4,");
|
||||
pr_cont(" TPSLP: 3/4,");
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
printk(" TPSLP: 5/6,");
|
||||
pr_cont(" TPSLP: 5/6,");
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
printk(" TPSLP: 7/8,");
|
||||
pr_cont(" TPSLP: 7/8,");
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(" TPSLP: Reserved,");
|
||||
pr_cont(" TPSLP: Reserved,");
|
||||
|
||||
}
|
||||
|
||||
switch (val & 0x07) {
|
||||
|
||||
case 0x00:
|
||||
printk(" TPSHP: 1/2,");
|
||||
pr_cont(" TPSHP: 1/2,");
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
printk(" TPSHP: 2/3,");
|
||||
pr_cont(" TPSHP: 2/3,");
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
printk(" TPSHP: 3/4,");
|
||||
pr_cont(" TPSHP: 3/4,");
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
printk(" TPSHP: 5/6,");
|
||||
pr_cont(" TPSHP: 5/6,");
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
printk(" TPSHP: 7/8,");
|
||||
pr_cont(" TPSHP: 7/8,");
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(" TPSHP: Reserved,");
|
||||
pr_cont(" TPSHP: Reserved,");
|
||||
|
||||
}
|
||||
|
||||
val = nxt6000_readreg(state, OFDM_TPS_RCVD_4);
|
||||
|
||||
printk(" TPSMode: %s,", val & 0x01 ? "8K" : "2K");
|
||||
pr_cont(" TPSMode: %s,", val & 0x01 ? "8K" : "2K");
|
||||
|
||||
switch ((val >> 4) & 0x03) {
|
||||
|
||||
case 0x00:
|
||||
printk(" TPSGuard: 1/32,");
|
||||
pr_cont(" TPSGuard: 1/32,");
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
printk(" TPSGuard: 1/16,");
|
||||
pr_cont(" TPSGuard: 1/16,");
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
printk(" TPSGuard: 1/8,");
|
||||
pr_cont(" TPSGuard: 1/8,");
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
printk(" TPSGuard: 1/4,");
|
||||
pr_cont(" TPSGuard: 1/4,");
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -416,8 +432,8 @@ static void nxt6000_dump_status(struct nxt6000_state *state)
|
||||
val = nxt6000_readreg(state, RF_AGC_STATUS);
|
||||
val = nxt6000_readreg(state, RF_AGC_STATUS);
|
||||
|
||||
printk(" RF AGC LOCK: %d,", (val >> 4) & 0x01);
|
||||
printk("\n");
|
||||
pr_cont(" RF AGC LOCK: %d,", (val >> 4) & 0x01);
|
||||
pr_cont("\n");
|
||||
}
|
||||
|
||||
static int nxt6000_read_status(struct dvb_frontend *fe, enum fe_status *status)
|
||||
@@ -548,7 +564,7 @@ static int nxt6000_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
|
||||
}
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops nxt6000_ops;
|
||||
static const struct dvb_frontend_ops nxt6000_ops;
|
||||
|
||||
struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -576,7 +592,7 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops nxt6000_ops = {
|
||||
static const struct dvb_frontend_ops nxt6000_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "NxtWave NXT6000 DVB-T",
|
||||
|
@@ -342,15 +342,13 @@ static int or51132_set_parameters(struct dvb_frontend *fe)
|
||||
fwname);
|
||||
ret = request_firmware(&fw, fwname, state->i2c->dev.parent);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "or51132: No firmware up"
|
||||
"loaded(timeout or file not found?)\n");
|
||||
printk(KERN_WARNING "or51132: No firmware uploaded(timeout or file not found?)\n");
|
||||
return ret;
|
||||
}
|
||||
ret = or51132_load_firmware(fe, fw);
|
||||
release_firmware(fw);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "or51132: Writing firmware to "
|
||||
"device failed!\n");
|
||||
printk(KERN_WARNING "or51132: Writing firmware to device failed!\n");
|
||||
return ret;
|
||||
}
|
||||
printk("or51132: Firmware upload complete.\n");
|
||||
@@ -561,7 +559,7 @@ static void or51132_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops or51132_ops;
|
||||
static const struct dvb_frontend_ops or51132_ops;
|
||||
|
||||
struct dvb_frontend* or51132_attach(const struct or51132_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -585,7 +583,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config,
|
||||
return &state->frontend;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops or51132_ops = {
|
||||
static const struct dvb_frontend_ops or51132_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Oren OR51132 VSB/QAM Frontend",
|
||||
|
@@ -377,8 +377,7 @@ static int or51211_init(struct dvb_frontend* fe)
|
||||
OR51211_DEFAULT_FIRMWARE);
|
||||
pr_info("Got Hotplug firmware\n");
|
||||
if (ret) {
|
||||
pr_warn("No firmware uploaded "
|
||||
"(timeout or file not found?)\n");
|
||||
pr_warn("No firmware uploaded (timeout or file not found?)\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -508,7 +507,7 @@ static void or51211_release(struct dvb_frontend* fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops or51211_ops;
|
||||
static const struct dvb_frontend_ops or51211_ops;
|
||||
|
||||
struct dvb_frontend* or51211_attach(const struct or51211_config* config,
|
||||
struct i2c_adapter* i2c)
|
||||
@@ -532,7 +531,7 @@ struct dvb_frontend* or51211_attach(const struct or51211_config* config,
|
||||
return &state->frontend;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops or51211_ops = {
|
||||
static const struct dvb_frontend_ops or51211_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Oren OR51211 VSB Frontend",
|
||||
|
@@ -548,7 +548,7 @@ static int rtl2830_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops rtl2830_ops = {
|
||||
static const struct dvb_frontend_ops rtl2830_ops = {
|
||||
.delsys = {SYS_DVBT},
|
||||
.info = {
|
||||
.name = "Realtek RTL2830 (DVB-T)",
|
||||
|
@@ -837,7 +837,7 @@ static int rtl2832_deselect(struct i2c_mux_core *muxc, u32 chan_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops rtl2832_ops = {
|
||||
static const struct dvb_frontend_ops rtl2832_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Realtek RTL2832 (DVB-T)",
|
||||
|
@@ -321,8 +321,8 @@ static int s5h1409_writereg(struct s5h1409_state *state, u8 reg, u16 data)
|
||||
ret = i2c_transfer(state->i2c, &msg, 1);
|
||||
|
||||
if (ret != 1)
|
||||
printk(KERN_ERR "%s: error (reg == 0x%02x, val == 0x%04x, "
|
||||
"ret == %i)\n", __func__, reg, data, ret);
|
||||
printk(KERN_ERR "%s: error (reg == 0x%02x, val == 0x%04x, ret == %i)\n",
|
||||
__func__, reg, data, ret);
|
||||
|
||||
return (ret != 1) ? -1 : 0;
|
||||
}
|
||||
@@ -949,7 +949,7 @@ static void s5h1409_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops s5h1409_ops;
|
||||
static const struct dvb_frontend_ops s5h1409_ops;
|
||||
|
||||
struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -995,7 +995,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(s5h1409_attach);
|
||||
|
||||
static struct dvb_frontend_ops s5h1409_ops = {
|
||||
static const struct dvb_frontend_ops s5h1409_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Samsung S5H1409 QAM/8VSB Frontend",
|
||||
|
@@ -350,8 +350,8 @@ static int s5h1411_writereg(struct s5h1411_state *state,
|
||||
ret = i2c_transfer(state->i2c, &msg, 1);
|
||||
|
||||
if (ret != 1)
|
||||
printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, "
|
||||
"ret == %i)\n", __func__, addr, reg, data, ret);
|
||||
printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, ret == %i)\n",
|
||||
__func__, addr, reg, data, ret);
|
||||
|
||||
return (ret != 1) ? -1 : 0;
|
||||
}
|
||||
@@ -864,7 +864,7 @@ static void s5h1411_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops s5h1411_ops;
|
||||
static const struct dvb_frontend_ops s5h1411_ops;
|
||||
|
||||
struct dvb_frontend *s5h1411_attach(const struct s5h1411_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -914,7 +914,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(s5h1411_attach);
|
||||
|
||||
static struct dvb_frontend_ops s5h1411_ops = {
|
||||
static const struct dvb_frontend_ops s5h1411_ops = {
|
||||
.delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
|
||||
.info = {
|
||||
.name = "Samsung S5H1411 QAM/8VSB Frontend",
|
||||
|
@@ -880,7 +880,7 @@ struct i2c_adapter *s5h1420_get_tuner_i2c_adapter(struct dvb_frontend *fe)
|
||||
}
|
||||
EXPORT_SYMBOL(s5h1420_get_tuner_i2c_adapter);
|
||||
|
||||
static struct dvb_frontend_ops s5h1420_ops;
|
||||
static const struct dvb_frontend_ops s5h1420_ops;
|
||||
|
||||
struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -934,7 +934,7 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL(s5h1420_attach);
|
||||
|
||||
static struct dvb_frontend_ops s5h1420_ops = {
|
||||
static const struct dvb_frontend_ops s5h1420_ops = {
|
||||
.delsys = { SYS_DVBS },
|
||||
.info = {
|
||||
.name = "Samsung S5H1420/PnpNetwork PN1010 DVB-S",
|
||||
|
@@ -63,8 +63,8 @@ static int s5h1432_writereg(struct s5h1432_state *state,
|
||||
ret = i2c_transfer(state->i2c, &msg, 1);
|
||||
|
||||
if (ret != 1)
|
||||
printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, "
|
||||
"ret == %i)\n", __func__, addr, reg, data, ret);
|
||||
printk(KERN_ERR "%s: writereg error 0x%02x 0x%02x 0x%04x, ret == %i)\n",
|
||||
__func__, addr, reg, data, ret);
|
||||
|
||||
return (ret != 1) ? -1 : 0;
|
||||
}
|
||||
@@ -341,7 +341,7 @@ static void s5h1432_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops s5h1432_ops;
|
||||
static const struct dvb_frontend_ops s5h1432_ops;
|
||||
|
||||
struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -370,7 +370,7 @@ struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config,
|
||||
}
|
||||
EXPORT_SYMBOL(s5h1432_attach);
|
||||
|
||||
static struct dvb_frontend_ops s5h1432_ops = {
|
||||
static const struct dvb_frontend_ops s5h1432_ops = {
|
||||
.delsys = { SYS_DVBT },
|
||||
.info = {
|
||||
.name = "Samsung s5h1432 DVB-T Frontend",
|
||||
|
@@ -214,8 +214,8 @@ static int s921_i2c_writereg(struct s921_state *state,
|
||||
|
||||
rc = i2c_transfer(state->i2c, &msg, 1);
|
||||
if (rc != 1) {
|
||||
printk("%s: writereg rcor(rc == %i, reg == 0x%02x,"
|
||||
" data == 0x%02x)\n", __func__, rc, reg, data);
|
||||
printk("%s: writereg rcor(rc == %i, reg == 0x%02x, data == 0x%02x)\n",
|
||||
__func__, rc, reg, data);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ static void s921_release(struct dvb_frontend *fe)
|
||||
kfree(state);
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops s921_ops;
|
||||
static const struct dvb_frontend_ops s921_ops;
|
||||
|
||||
struct dvb_frontend *s921_attach(const struct s921_config *config,
|
||||
struct i2c_adapter *i2c)
|
||||
@@ -505,7 +505,7 @@ struct dvb_frontend *s921_attach(const struct s921_config *config,
|
||||
}
|
||||
EXPORT_SYMBOL(s921_attach);
|
||||
|
||||
static struct dvb_frontend_ops s921_ops = {
|
||||
static const struct dvb_frontend_ops s921_ops = {
|
||||
.delsys = { SYS_ISDBT },
|
||||
/* Use dib8000 values per default */
|
||||
.info = {
|
||||
|
@@ -978,7 +978,7 @@ static int si2165_set_frontend(struct dvb_frontend *fe)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dvb_frontend_ops si2165_ops = {
|
||||
static const struct dvb_frontend_ops si2165_ops = {
|
||||
.info = {
|
||||
.name = "Silicon Labs ",
|
||||
/* For DVB-C */
|
||||
|
某些文件未显示,因为此 diff 中更改的文件太多 显示更多
在新工单中引用
屏蔽一个用户