Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab:
 "The first part of the media updates for Kernel 3.7.

  This series contain:

   - A major tree renaming patch series: now, drivers are organized
     internally by their used bus, instead of by V4L2 and/or DVB API,
     providing a cleaner driver location for hybrid drivers that
     implement both APIs, and allowing to cleanup the Kconfig items and
     make them more intuitive for the end user;

   - Media Kernel developers are typically very lazy with their duties
     of keeping the MAINTAINERS entries for their drivers updated.  As
     now the tree is more organized, we're doing an effort to add/update
     those entries for the drivers that aren't currently orphan;

   - Several DVB USB drivers got moved to a new DVB USB v2 core; the new
     core fixes several bugs (as the existing one that got bitroted).
     Now, suspend/resume finally started to work fine (at least with
     some devices - we should expect more work with regards to it);

   - added multistream support for DVB-T2, and unified the API for
     DVB-S2 and ISDB-S.  Backward binary support is preserved;

   - as usual, a few new drivers, some V4L2 core improvements and lots
     of drivers improvements and fixes.

  There are some points to notice on this series:

   1) you should expect a trivial merge conflict on your tree, with the
      removal of Documentation/feature-removal-schedule.txt: this series
      would be adding two additional entries there.  I opted to not
      rebase it due to this recent change;

   2) With regards to the PCTV 520e udev-related breakage, I opted to
      fix it in a way that the patches can be backported to 3.5 even
      without your firmware fix patch.  This way, Greg doesn't need to
      rush backporting your patch (as there are still the firmware cache
      and firmware path customization issues to be addressed there).

      I'll send later a patch (likely after the end of the merge window)
      reverting the rest of the DRX-K async firmware request, fully
      restoring its original behaviour to allow media drivers to
      initialize everything serialized as before for 3.7 and upper.

   3) I'm planning to work on this weekend to test the DMABUF patches
      for V4L2.  The patches are on my queue for several Kernel cycles,
      but, up to now, there is/was no way to test the series locally.

      I have some concerns about this particular changeset with regards
      to security issues, and with regards to the replacement of the old
      VIDIOC_OVERLAY ioctl's that is broken on modern systems, due to
      GPU drivers change.  The Overlay API allows direct PCI2PCI
      transfers from a media capture card into the GPU framebuffer, but
      its API is crappy.  Also, the only existing X11 driver that
      implements it requires a XV extension that is not available
      anymore on modern drivers.  The DMABUF can do the same thing, but
      with it is promising to be a properly-designed API.  If I can
      successfully test this series and be happy with it, I should be
      asking you to pull them next week."

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (717 commits)
  em28xx: regression fix: use DRX-K sync firmware requests on em28xx
  drxk: allow loading firmware synchrousnously
  em28xx: Make all em28xx extensions to be initialized asynchronously
  [media] tda18271: properly report read errors in tda18271_get_id
  [media] tda18271: delay IR & RF calibration until init() if delay_cal is set
  [media] MAINTAINERS: add Michael Krufky as tda827x maintainer
  [media] MAINTAINERS: add Michael Krufky as tda8290 maintainer
  [media] MAINTAINERS: add Michael Krufky as cxusb maintainer
  [media] MAINTAINERS: add Michael Krufky as lg2160 maintainer
  [media] MAINTAINERS: add Michael Krufky as lgdt3305 maintainer
  [media] MAINTAINERS: add Michael Krufky as mxl111sf maintainer
  [media] MAINTAINERS: add Michael Krufky as mxl5007t maintainer
  [media] MAINTAINERS: add Michael Krufky as tda18271 maintainer
  [media] s5p-tv: Report only multi-plane capabilities in vidioc_querycap
  [media] s5p-mfc: Fix misplaced return statement in s5p_mfc_suspend()
  [media] exynos-gsc: Add missing static storage class specifiers
  [media] exynos-gsc: Remove <linux/version.h> header file inclusion
  [media] s5p-fimc: Fix incorrect condition in fimc_lite_reqbufs()
  [media] s5p-tv: Fix potential NULL pointer dereference error
  [media] s5k6aa: Fix possible NULL pointer dereference
  ...
This commit is contained in:
Linus Torvalds 2012-10-07 17:49:05 +09:00
commit 0b8e74c6f4
1670 changed files with 39018 additions and 26499 deletions

View file

@ -99,11 +99,6 @@ config VIDEO_DEV
depends on MEDIA_CAMERA_SUPPORT || MEDIA_ANALOG_TV_SUPPORT || MEDIA_RADIO_SUPPORT
default y
config VIDEO_V4L2_COMMON
tristate
depends on (I2C || I2C=n) && VIDEO_DEV
default (I2C || I2C=n) && VIDEO_DEV
config VIDEO_V4L2_SUBDEV_API
bool "V4L2 sub-device userspace API (EXPERIMENTAL)"
depends on VIDEO_DEV && MEDIA_CONTROLLER && EXPERIMENTAL
@ -113,6 +108,8 @@ config VIDEO_V4L2_SUBDEV_API
This API is mostly used by camera interfaces in embedded platforms.
source "drivers/media/v4l2-core/Kconfig"
#
# DVB Core
# Only enables if one of DTV is selected
@ -138,28 +135,54 @@ config DVB_NET
You may want to disable the network support on embedded devices. If
unsure say Y.
source "drivers/media/dvb-core/Kconfig"
comment "Media drivers"
source "drivers/media/common/Kconfig"
source "drivers/media/rc/Kconfig"
#
# Tuner drivers for DVB and V4L
# V4L platform/mem2mem drivers
#
source "drivers/media/common/tuners/Kconfig"
#
# Video/Radio/Hybrid adapters
#
source "drivers/media/video/Kconfig"
source "drivers/media/usb/Kconfig"
source "drivers/media/pci/Kconfig"
source "drivers/media/platform/Kconfig"
source "drivers/media/mmc/Kconfig"
source "drivers/media/parport/Kconfig"
source "drivers/media/radio/Kconfig"
comment "Supported FireWire (IEEE 1394) Adapters"
depends on DVB_CORE && FIREWIRE
source "drivers/media/firewire/Kconfig"
# Common driver options
source "drivers/media/common/Kconfig"
#
# DVB adapters
# Ancillary drivers (tuners, i2c, frontends)
#
source "drivers/media/dvb/Kconfig"
config MEDIA_SUBDRV_AUTOSELECT
bool "Autoselect analog and hybrid tuner modules to build"
depends on MEDIA_TUNER
default y
help
By default, a TV driver auto-selects all possible tuners
thar could be used by the driver.
This is generally the right thing to do, except when there
are strict constraints with regards to the kernel size.
Use this option with care, as deselecting tuner drivers which
are in fact necessary will result in TV devices which cannot
be tuned due to lack of the tuning driver.
If unsure say Y.
comment "Media ancillary drivers (tuners, sensors, i2c, frontends)"
source "drivers/media/i2c/Kconfig"
source "drivers/media/tuners/Kconfig"
source "drivers/media/dvb-frontends/Kconfig"
endif # MEDIA_SUPPORT

View file

@ -4,11 +4,30 @@
media-objs := media-device.o media-devnode.o media-entity.o
#
# I2C drivers should come before other drivers, otherwise they'll fail
# when compiled as builtin drivers
#
obj-y += i2c/ tuners/
obj-$(CONFIG_DVB_CORE) += dvb-frontends/
#
# Now, let's link-in the media core
#
ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
obj-$(CONFIG_MEDIA_SUPPORT) += media.o
endif
obj-y += common/ rc/ video/
obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
obj-$(CONFIG_DVB_CORE) += dvb-core/
# There are both core and drivers at RC subtree - merge before drivers
obj-y += rc/
#
# Finally, merge the drivers that require the core
#
obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ parport/
obj-$(CONFIG_VIDEO_DEV) += radio/
obj-$(CONFIG_DVB_CORE) += dvb/

View file

@ -1,9 +1,3 @@
config VIDEO_SAA7146
tristate
depends on I2C && PCI
config VIDEO_SAA7146_VV
tristate
depends on VIDEO_V4L2
select VIDEOBUF_DMA_SG
select VIDEO_SAA7146
source "drivers/media/common/b2c2/Kconfig"
source "drivers/media/common/saa7146/Kconfig"
source "drivers/media/common/siano/Kconfig"

View file

@ -1,6 +1 @@
saa7146-objs := saa7146_i2c.o saa7146_core.o
saa7146_vv-objs := saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o
obj-y += tuners/
obj-$(CONFIG_VIDEO_SAA7146) += saa7146.o
obj-$(CONFIG_VIDEO_SAA7146_VV) += saa7146_vv.o
obj-y += b2c2/ saa7146/ siano/

View file

@ -0,0 +1,28 @@
config DVB_B2C2_FLEXCOP
tristate
depends on DVB_CORE && I2C
depends on DVB_B2C2_FLEXCOP_PCI || DVB_B2C2_FLEXCOP_USB
default y
select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
select DVB_STV0299 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MT352 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MT312 if MEDIA_SUBDRV_AUTOSELECT
select DVB_NXT200X if MEDIA_SUBDRV_AUTOSELECT
select DVB_STV0297 if MEDIA_SUBDRV_AUTOSELECT
select DVB_BCM3510 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LGDT330X if MEDIA_SUBDRV_AUTOSELECT
select DVB_S5H1420 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_ITD1000 if MEDIA_SUBDRV_AUTOSELECT
select DVB_ISL6421 if MEDIA_SUBDRV_AUTOSELECT
select DVB_CX24123 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_CX24113 if MEDIA_SUBDRV_AUTOSELECT
help
Support for the digital TV receiver chip made by B2C2 Inc. included in
Technisats PCI cards and USB boxes.
Say Y if you own such a device and want to use it.
# Selected via the PCI or USB flexcop drivers
config DVB_B2C2_FLEXCOP_DEBUG
bool

View file

@ -0,0 +1,8 @@
b2c2-flexcop-objs += flexcop.o flexcop-fe-tuner.o flexcop-i2c.o
b2c2-flexcop-objs += flexcop-sram.o flexcop-eeprom.o flexcop-misc.o
b2c2-flexcop-objs += flexcop-hw-filter.o
obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o
ccflags-y += -Idrivers/media/dvb-core/
ccflags-y += -Idrivers/media/dvb-frontends/
ccflags-y += -Idrivers/media/tuners/

View file

@ -43,6 +43,7 @@
#endif
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,"

View file

@ -0,0 +1,9 @@
config VIDEO_SAA7146
tristate
depends on I2C && PCI
config VIDEO_SAA7146_VV
tristate
depends on VIDEO_V4L2
select VIDEOBUF_DMA_SG
select VIDEO_SAA7146

View file

@ -0,0 +1,5 @@
saa7146-objs := saa7146_i2c.o saa7146_core.o
saa7146_vv-objs := saa7146_fops.o saa7146_video.o saa7146_hlp.o saa7146_vbi.o
obj-$(CONFIG_VIDEO_SAA7146) += saa7146.o
obj-$(CONFIG_VIDEO_SAA7146_VV) += saa7146_vv.o

View file

@ -23,9 +23,6 @@
#include <media/saa7146.h>
#include <linux/module.h>
LIST_HEAD(saa7146_devices);
DEFINE_MUTEX(saa7146_devices_lock);
static int saa7146_num;
unsigned int saa7146_debug;
@ -482,8 +479,6 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
set it explicitly. */
pci_set_drvdata(pci, &dev->v4l2_dev);
INIT_LIST_HEAD(&dev->item);
list_add_tail(&dev->item,&saa7146_devices);
saa7146_num++;
err = 0;
@ -545,7 +540,6 @@ static void saa7146_remove_one(struct pci_dev *pdev)
iounmap(dev->mem);
pci_release_region(pdev, 0);
list_del(&dev->item);
pci_disable_device(pdev);
kfree(dev);
@ -592,8 +586,6 @@ EXPORT_SYMBOL_GPL(saa7146_setgpio);
EXPORT_SYMBOL_GPL(saa7146_i2c_adapter_prepare);
EXPORT_SYMBOL_GPL(saa7146_debug);
EXPORT_SYMBOL_GPL(saa7146_devices);
EXPORT_SYMBOL_GPL(saa7146_devices_lock);
MODULE_AUTHOR("Michael Hunold <[email protected]>");
MODULE_DESCRIPTION("driver for generic saa7146-based hardware");

View file

@ -201,7 +201,7 @@ static int fops_open(struct file *file)
DEB_EE("file:%p, dev:%s\n", file, video_device_node_name(vdev));
if (mutex_lock_interruptible(&saa7146_devices_lock))
if (mutex_lock_interruptible(vdev->lock))
return -ERESTARTSYS;
DEB_D("using: %p\n", dev);
@ -253,7 +253,7 @@ out:
kfree(fh);
file->private_data = NULL;
}
mutex_unlock(&saa7146_devices_lock);
mutex_unlock(vdev->lock);
return result;
}
@ -265,7 +265,7 @@ static int fops_release(struct file *file)
DEB_EE("file:%p\n", file);
if (mutex_lock_interruptible(&saa7146_devices_lock))
if (mutex_lock_interruptible(vdev->lock))
return -ERESTARTSYS;
if (vdev->vfl_type == VFL_TYPE_VBI) {
@ -283,7 +283,7 @@ static int fops_release(struct file *file)
file->private_data = NULL;
kfree(fh);
mutex_unlock(&saa7146_devices_lock);
mutex_unlock(vdev->lock);
return 0;
}
@ -293,6 +293,7 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma)
struct video_device *vdev = video_devdata(file);
struct saa7146_fh *fh = file->private_data;
struct videobuf_queue *q;
int res;
switch (vdev->vfl_type) {
case VFL_TYPE_GRABBER: {
@ -314,10 +315,14 @@ static int fops_mmap(struct file *file, struct vm_area_struct * vma)
return 0;
}
return videobuf_mmap_mapper(q,vma);
if (mutex_lock_interruptible(vdev->lock))
return -ERESTARTSYS;
res = videobuf_mmap_mapper(q, vma);
mutex_unlock(vdev->lock);
return res;
}
static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
static unsigned int __fops_poll(struct file *file, struct poll_table_struct *wait)
{
struct video_device *vdev = video_devdata(file);
struct saa7146_fh *fh = file->private_data;
@ -356,10 +361,22 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
return res;
}
static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
{
struct video_device *vdev = video_devdata(file);
unsigned int res;
mutex_lock(vdev->lock);
res = __fops_poll(file, wait);
mutex_unlock(vdev->lock);
return res;
}
static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct video_device *vdev = video_devdata(file);
struct saa7146_fh *fh = file->private_data;
int ret;
switch (vdev->vfl_type) {
case VFL_TYPE_GRABBER:
@ -373,8 +390,13 @@ static ssize_t fops_read(struct file *file, char __user *data, size_t count, lof
DEB_EE("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n",
file, data, (unsigned long)count);
*/
if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE)
return saa7146_vbi_uops.read(file,data,count,ppos);
if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) {
if (mutex_lock_interruptible(vdev->lock))
return -ERESTARTSYS;
ret = saa7146_vbi_uops.read(file, data, count, ppos);
mutex_unlock(vdev->lock);
return ret;
}
return -EINVAL;
default:
BUG();
@ -386,15 +408,20 @@ static ssize_t fops_write(struct file *file, const char __user *data, size_t cou
{
struct video_device *vdev = video_devdata(file);
struct saa7146_fh *fh = file->private_data;
int ret;
switch (vdev->vfl_type) {
case VFL_TYPE_GRABBER:
return -EINVAL;
case VFL_TYPE_VBI:
if (fh->dev->ext_vv_data->vbi_fops.write)
return fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos);
else
return -EINVAL;
if (fh->dev->ext_vv_data->vbi_fops.write) {
if (mutex_lock_interruptible(vdev->lock))
return -ERESTARTSYS;
ret = fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos);
mutex_unlock(vdev->lock);
return ret;
}
return -EINVAL;
default:
BUG();
return -EINVAL;
@ -584,10 +611,6 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
else
vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops;
vfd->release = video_device_release;
/* Locking in file operations other than ioctl should be done by
the driver, not the V4L2 core.
This driver needs auditing so that this flag can be removed. */
set_bit(V4L2_FL_LOCK_ALL_FOPS, &vfd->flags);
vfd->lock = &dev->v4l2_lock;
vfd->v4l2_dev = &dev->v4l2_dev;
vfd->tvnorms = 0;

View file

@ -479,7 +479,7 @@ static int vidioc_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
return 0;
}
static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb)
static int vidioc_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffer *fb)
{
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
struct saa7146_vv *vv = dev->vv_data;

View file

@ -0,0 +1,17 @@
#
# Siano Mobile Silicon Digital TV device configuration
#
config SMS_SIANO_MDTV
tristate
depends on DVB_CORE && RC_CORE && HAS_DMA
depends on SMS_USB_DRV || SMS_SDIO_DRV
default y
---help---
Choose Y or M here if you have MDTV receiver with a Siano chipset.
To compile this driver as a module, choose M here
(The module will be called smsmdtv).
Further documentation on this driver can be found on the WWW
at http://www.siano-ms.com/

View file

@ -1,11 +1,7 @@
smsmdtv-objs := smscoreapi.o sms-cards.o smsendian.o smsir.o
obj-$(CONFIG_SMS_SIANO_MDTV) += smsmdtv.o smsdvb.o
obj-$(CONFIG_SMS_USB_DRV) += smsusb.o
obj-$(CONFIG_SMS_SDIO_DRV) += smssdio.o
ccflags-y += -Idrivers/media/dvb/dvb-core
ccflags-y += -Idrivers/media/dvb-core
ccflags-y += $(extra-cflags-y) $(extra-cflags-m)

View file

@ -0,0 +1,29 @@
#
# DVB device configuration
#
config DVB_MAX_ADAPTERS
int "maximum number of DVB/ATSC adapters"
depends on DVB_CORE
default 8
range 1 255
help
Maximum number of DVB/ATSC adapters. Increasing this number
increases the memory consumption of the DVB subsystem even
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
config DVB_DYNAMIC_MINORS
bool "Dynamic DVB minor allocation"
depends on DVB_CORE
default n
help
If you say Y here, the DVB subsystem will use dynamic minor
allocation for any device that uses the DVB major number.
This means that you can have more than 4 of a single type
of device (like demuxes and frontends) per adapter, but udev
will be required to manage the device nodes.
If you are unsure about this, say N here.

View file

@ -370,9 +370,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
return 0;
}
del_timer(&dmxdevfilter->timer);
dprintk("dmxdev: section callback %02x %02x %02x %02x %02x %02x\n",
buffer1[0], buffer1[1],
buffer1[2], buffer1[3], buffer1[4], buffer1[5]);
dprintk("dmxdev: section callback %*ph\n", 6, buffer1);
ret = dvb_dmxdev_buffer_write(&dmxdevfilter->buffer, buffer1,
buffer1_len);
if (ret == buffer1_len) {

View file

@ -24,6 +24,7 @@
#define USB_VID_COMPRO_UNK 0x145f
#define USB_VID_CONEXANT 0x0572
#define USB_VID_CYPRESS 0x04b4
#define USB_VID_DEXATEK 0x1d19
#define USB_VID_DIBCOM 0x10b8
#define USB_VID_DPOSH 0x1498
#define USB_VID_DVICO 0x0fe9
@ -82,6 +83,7 @@
#define USB_PID_AFATECH_AF9035_1003 0x1003
#define USB_PID_AFATECH_AF9035_9035 0x9035
#define USB_PID_TREKSTOR_DVBT 0x901b
#define USB_PID_TREKSTOR_TERRES_2_0 0xC803
#define USB_VID_ALINK_DTU 0xf170
#define USB_PID_ANSONIC_DVBT_USB 0x6000
#define USB_PID_ANYSEE 0x861f
@ -327,6 +329,7 @@
#define USB_PID_ASUS_U3000 0x171f
#define USB_PID_ASUS_U3000H 0x1736
#define USB_PID_ASUS_U3100 0x173f
#define USB_PID_ASUS_U3100MINI_PLUS 0x1779
#define USB_PID_YUAN_EC372S 0x1edc
#define USB_PID_YUAN_STK7700PH 0x1f08
#define USB_PID_YUAN_PD378S 0x2edc

View file

@ -50,6 +50,11 @@ module_param(dvb_demux_speedcheck, int, 0644);
MODULE_PARM_DESC(dvb_demux_speedcheck,
"enable transport stream speed check");
static int dvb_demux_feed_err_pkts = 1;
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); \
@ -419,21 +424,25 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
printk(KERN_INFO "TS speed %llu Kbits/sec \n",
div64_u64(speed_bytes,
speed_timedelta));
};
}
demux->speed_last_time = cur_time;
demux->speed_pkts_cnt = 0;
};
};
}
}
if (buf[1] & 0x80) {
dprintk_tscheck("TEI detected. "
"PID=0x%x data1=0x%x\n",
pid, buf[1]);
/* data in this packet cant be trusted - drop it unless
* module option dvb_demux_feed_err_pkts is set */
if (!dvb_demux_feed_err_pkts)
return;
} else /* if TEI bit is set, pid may be wrong- skip pkt counter */
if (demux->cnt_storage && dvb_demux_tscheck) {
/* check pkt counter */
if (pid < MAX_PID) {
if (buf[1] & 0x80)
dprintk_tscheck("TEI detected. "
"PID=0x%x data1=0x%x\n",
pid, buf[1]);
if ((buf[3] & 0xf) != demux->cnt_storage[pid])
dprintk_tscheck("TS packet counter mismatch. "
"PID=0x%x expected 0x%x "
@ -442,9 +451,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
buf[3] & 0xf);
demux->cnt_storage[pid] = ((buf[3] & 0xf) + 1)&0xf;
};
}
/* end check */
};
}
list_for_each_entry(feed, &demux->feed_list, list_head) {
if ((feed->pid != pid) && (feed->pid != 0x2000))

View file

@ -66,8 +66,6 @@ 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 if (dvb_frontend_debug) printk
#define FESTATE_IDLE 1
#define FESTATE_RETUNE 2
#define FESTATE_TUNING_FAST 4
@ -179,7 +177,7 @@ static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system)
case SYS_DVBT:
case SYS_DVBT2:
case SYS_ISDBT:
case SYS_DMBTH:
case SYS_DTMB:
return DVBV3_OFDM;
case SYS_ATSC:
case SYS_ATSCMH:
@ -207,7 +205,7 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
struct dvb_frontend_event *e;
int wp;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if ((status & FE_HAS_LOCK) && has_get_frontend(fe))
dtv_get_frontend(fe, &fepriv->parameters_out);
@ -237,7 +235,7 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe,
struct dvb_frontend_private *fepriv = fe->frontend_priv;
struct dvb_fe_events *events = &fepriv->events;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if (events->overflow) {
events->overflow = 0;
@ -282,10 +280,9 @@ static void dvb_frontend_clear_events(struct dvb_frontend *fe)
static void dvb_frontend_init(struct dvb_frontend *fe)
{
dprintk ("DVB: initialising adapter %i frontend %i (%s)...\n",
fe->dvb->num,
fe->id,
fe->ops.info.name);
dev_dbg(fe->dvb->device,
"%s: initialising adapter %i frontend %i (%s)...\n",
__func__, fe->dvb->num, fe->id, fe->ops.info.name);
if (fe->ops.init)
fe->ops.init(fe);
@ -310,8 +307,9 @@ EXPORT_SYMBOL(dvb_frontend_reinitialise);
static void dvb_frontend_swzigzag_update_delay(struct dvb_frontend_private *fepriv, int locked)
{
int q2;
struct dvb_frontend *fe = fepriv->dvbdev->priv;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if (locked)
(fepriv->quality) = (fepriv->quality * 220 + 36*256) / 256;
@ -403,10 +401,11 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra
return 1;
}
dprintk("%s: drift:%i inversion:%i auto_step:%i "
"auto_sub_step:%i started_auto_step:%i\n",
__func__, fepriv->lnb_drift, fepriv->inversion,
fepriv->auto_step, fepriv->auto_sub_step, fepriv->started_auto_step);
dev_dbg(fe->dvb->device, "%s: drift:%i inversion:%i auto_step:%i " \
"auto_sub_step:%i started_auto_step:%i\n",
__func__, fepriv->lnb_drift, fepriv->inversion,
fepriv->auto_step, fepriv->auto_sub_step,
fepriv->started_auto_step);
/* set the frontend itself */
c->frequency += fepriv->lnb_drift;
@ -605,7 +604,7 @@ static int dvb_frontend_thread(void *data)
bool re_tune = false;
dprintk("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
fepriv->check_wrapped = 0;
fepriv->quality = 0;
@ -651,10 +650,10 @@ restart:
algo = fe->ops.get_frontend_algo(fe);
switch (algo) {
case DVBFE_ALGO_HW:
dprintk("%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__);
dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__);
if (fepriv->state & FESTATE_RETUNE) {
dprintk("%s: Retune requested, FESTATE_RETUNE\n", __func__);
dev_dbg(fe->dvb->device, "%s: Retune requested, FESTATE_RETUNE\n", __func__);
re_tune = true;
fepriv->state = FESTATE_TUNED;
} else {
@ -665,19 +664,19 @@ restart:
fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s);
if (s != fepriv->status && !(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) {
dprintk("%s: state changed, adding current state\n", __func__);
dev_dbg(fe->dvb->device, "%s: state changed, adding current state\n", __func__);
dvb_frontend_add_event(fe, s);
fepriv->status = s;
}
break;
case DVBFE_ALGO_SW:
dprintk("%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__);
dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__);
dvb_frontend_swzigzag(fe);
break;
case DVBFE_ALGO_CUSTOM:
dprintk("%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->state);
dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->state);
if (fepriv->state & FESTATE_RETUNE) {
dprintk("%s: Retune requested, FESTAT_RETUNE\n", __func__);
dev_dbg(fe->dvb->device, "%s: Retune requested, FESTAT_RETUNE\n", __func__);
fepriv->state = FESTATE_TUNED;
}
/* Case where we are going to search for a carrier
@ -713,7 +712,7 @@ restart:
}
break;
default:
dprintk("%s: UNDEFINED ALGO !\n", __func__);
dev_dbg(fe->dvb->device, "%s: UNDEFINED ALGO !\n", __func__);
break;
}
} else {
@ -750,7 +749,7 @@ static void dvb_frontend_stop(struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
fepriv->exit = DVB_FE_NORMAL_EXIT;
mb();
@ -765,7 +764,8 @@ static void dvb_frontend_stop(struct dvb_frontend *fe)
/* paranoia check in case a signal arrived */
if (fepriv->thread)
printk("dvb_frontend_stop: warning: thread %p won't exit\n",
dev_warn(fe->dvb->device,
"dvb_frontend_stop: warning: thread %p won't exit\n",
fepriv->thread);
}
@ -818,7 +818,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
struct dvb_frontend_private *fepriv = fe->frontend_priv;
struct task_struct *fe_thread;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if (fepriv->thread) {
if (fepriv->exit == DVB_FE_NO_EXIT)
@ -841,7 +841,9 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
"kdvb-ad-%i-fe-%i", fe->dvb->num,fe->id);
if (IS_ERR(fe_thread)) {
ret = PTR_ERR(fe_thread);
printk("dvb_frontend_start: failed to start kthread (%d)\n", ret);
dev_warn(fe->dvb->device,
"dvb_frontend_start: failed to start kthread (%d)\n",
ret);
up(&fepriv->sem);
return ret;
}
@ -862,8 +864,8 @@ static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe,
*freq_max = min(fe->ops.info.frequency_max, fe->ops.tuner_ops.info.frequency_max);
if (*freq_min == 0 || *freq_max == 0)
printk(KERN_WARNING "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n",
fe->dvb->num,fe->id);
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n",
fe->dvb->num, fe->id);
}
static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
@ -876,8 +878,9 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
dvb_frontend_get_frequency_limits(fe, &freq_min, &freq_max);
if ((freq_min && c->frequency < freq_min) ||
(freq_max && c->frequency > freq_max)) {
printk(KERN_WARNING "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->frequency, freq_min, freq_max);
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->frequency,
freq_min, freq_max);
return -EINVAL;
}
@ -892,10 +895,10 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
c->symbol_rate < fe->ops.info.symbol_rate_min) ||
(fe->ops.info.symbol_rate_max &&
c->symbol_rate > fe->ops.info.symbol_rate_max)) {
printk(KERN_WARNING "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->symbol_rate,
fe->ops.info.symbol_rate_min,
fe->ops.info.symbol_rate_max);
dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
fe->dvb->num, fe->id, c->symbol_rate,
fe->ops.info.symbol_rate_min,
fe->ops.info.symbol_rate_max);
return -EINVAL;
}
default:
@ -917,8 +920,8 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
c->state = DTV_CLEAR;
dprintk("%s() Clearing cache for delivery system %d\n", __func__,
c->delivery_system);
dev_dbg(fe->dvb->device, "%s: Clearing cache for delivery system %d\n",
__func__, c->delivery_system);
c->transmission_mode = TRANSMISSION_MODE_AUTO;
c->bandwidth_hz = 0; /* AUTO */
@ -946,8 +949,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
c->layer[i].segment_count = 0;
}
c->isdbs_ts_id = 0;
c->dvbt2_plp_id = 0;
c->stream_id = NO_STREAM_ID_FILTER;
switch (c->delivery_system) {
case SYS_DVBS:
@ -997,6 +999,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_CODE_RATE_LP, 1, 0),
_DTV_CMD(DTV_GUARD_INTERVAL, 1, 0),
_DTV_CMD(DTV_TRANSMISSION_MODE, 1, 0),
_DTV_CMD(DTV_INTERLEAVING, 1, 0),
_DTV_CMD(DTV_ISDBT_PARTIAL_RECEPTION, 1, 0),
_DTV_CMD(DTV_ISDBT_SOUND_BROADCASTING, 1, 0),
@ -1017,8 +1020,9 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0),
_DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0),
_DTV_CMD(DTV_ISDBS_TS_ID, 1, 0),
_DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0),
_DTV_CMD(DTV_STREAM_ID, 1, 0),
_DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
_DTV_CMD(DTV_LNA, 1, 0),
/* Get */
_DTV_CMD(DTV_DISEQC_SLAVE_REPLY, 0, 1),
@ -1028,6 +1032,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_GUARD_INTERVAL, 0, 0),
_DTV_CMD(DTV_TRANSMISSION_MODE, 0, 0),
_DTV_CMD(DTV_HIERARCHY, 0, 0),
_DTV_CMD(DTV_INTERLEAVING, 0, 0),
_DTV_CMD(DTV_ENUM_DELSYS, 0, 0),
@ -1051,35 +1056,31 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
_DTV_CMD(DTV_ATSCMH_SCCC_CODE_MODE_D, 0, 0),
};
static void dtv_property_dump(struct dtv_property *tvp)
static void dtv_property_dump(struct dvb_frontend *fe, struct dtv_property *tvp)
{
int i;
if (tvp->cmd <= 0 || tvp->cmd > DTV_MAX_COMMAND) {
printk(KERN_WARNING "%s: tvp.cmd = 0x%08x undefined\n",
__func__, tvp->cmd);
dev_warn(fe->dvb->device, "%s: tvp.cmd = 0x%08x undefined\n",
__func__, tvp->cmd);
return;
}
dprintk("%s() tvp.cmd = 0x%08x (%s)\n"
,__func__
,tvp->cmd
,dtv_cmds[ tvp->cmd ].name);
dev_dbg(fe->dvb->device, "%s: tvp.cmd = 0x%08x (%s)\n", __func__,
tvp->cmd, dtv_cmds[tvp->cmd].name);
if(dtv_cmds[ tvp->cmd ].buffer) {
dprintk("%s() tvp.u.buffer.len = 0x%02x\n"
,__func__
,tvp->u.buffer.len);
if (dtv_cmds[tvp->cmd].buffer) {
dev_dbg(fe->dvb->device, "%s: tvp.u.buffer.len = 0x%02x\n",
__func__, tvp->u.buffer.len);
for(i = 0; i < tvp->u.buffer.len; i++)
dprintk("%s() tvp.u.buffer.data[0x%02x] = 0x%02x\n"
,__func__
,i
,tvp->u.buffer.data[i]);
} else
dprintk("%s() tvp.u.data = 0x%08x\n", __func__, tvp->u.data);
dev_dbg(fe->dvb->device,
"%s: tvp.u.buffer.data[0x%02x] = 0x%02x\n",
__func__, i, tvp->u.buffer.data[i]);
} else {
dev_dbg(fe->dvb->device, "%s: tvp.u.data = 0x%08x\n", __func__,
tvp->u.data);
}
}
/* Synchronise the legacy tuning parameters into the cache, so that demodulator
@ -1095,18 +1096,19 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe,
switch (dvbv3_type(c->delivery_system)) {
case DVBV3_QPSK:
dprintk("%s() Preparing QPSK req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__);
c->symbol_rate = p->u.qpsk.symbol_rate;
c->fec_inner = p->u.qpsk.fec_inner;
break;
case DVBV3_QAM:
dprintk("%s() Preparing QAM req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__);
c->symbol_rate = p->u.qam.symbol_rate;
c->fec_inner = p->u.qam.fec_inner;
c->modulation = p->u.qam.modulation;
break;
case DVBV3_OFDM:
dprintk("%s() Preparing OFDM req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__);
switch (p->u.ofdm.bandwidth) {
case BANDWIDTH_10_MHZ:
c->bandwidth_hz = 10000000;
@ -1138,7 +1140,7 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe,
c->hierarchy = p->u.ofdm.hierarchy_information;
break;
case DVBV3_ATSC:
dprintk("%s() Preparing ATSC req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing ATSC req\n", __func__);
c->modulation = p->u.vsb.modulation;
if (c->delivery_system == SYS_ATSCMH)
break;
@ -1148,9 +1150,9 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe,
c->delivery_system = SYS_DVBC_ANNEX_B;
break;
case DVBV3_UNKNOWN:
printk(KERN_ERR
"%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
__func__, c->delivery_system);
dev_err(fe->dvb->device,
"%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
__func__, c->delivery_system);
return -EINVAL;
}
@ -1170,24 +1172,23 @@ static int dtv_property_legacy_params_sync(struct dvb_frontend *fe,
switch (dvbv3_type(c->delivery_system)) {
case DVBV3_UNKNOWN:
printk(KERN_ERR
"%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
__func__, c->delivery_system);
dev_err(fe->dvb->device,
"%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
__func__, c->delivery_system);
return -EINVAL;
case DVBV3_QPSK:
dprintk("%s() Preparing QPSK req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__);
p->u.qpsk.symbol_rate = c->symbol_rate;
p->u.qpsk.fec_inner = c->fec_inner;
break;
case DVBV3_QAM:
dprintk("%s() Preparing QAM req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__);
p->u.qam.symbol_rate = c->symbol_rate;
p->u.qam.fec_inner = c->fec_inner;
p->u.qam.modulation = c->modulation;
break;
case DVBV3_OFDM:
dprintk("%s() Preparing OFDM req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__);
switch (c->bandwidth_hz) {
case 10000000:
p->u.ofdm.bandwidth = BANDWIDTH_10_MHZ;
@ -1219,7 +1220,7 @@ static int dtv_property_legacy_params_sync(struct dvb_frontend *fe,
p->u.ofdm.hierarchy_information = c->hierarchy;
break;
case DVBV3_ATSC:
dprintk("%s() Preparing VSB req\n", __func__);
dev_dbg(fe->dvb->device, "%s: Preparing VSB req\n", __func__);
p->u.vsb.modulation = c->modulation;
break;
}
@ -1326,6 +1327,9 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
case DTV_HIERARCHY:
tvp->u.data = c->hierarchy;
break;
case DTV_INTERLEAVING:
tvp->u.data = c->interleaving;
break;
/* ISDB-T Support here */
case DTV_ISDBT_PARTIAL_RECEPTION:
@ -1382,11 +1386,11 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
tvp->u.data = c->layer[2].interleaving;
break;
case DTV_ISDBS_TS_ID:
tvp->u.data = c->isdbs_ts_id;
break;
case DTV_DVBT2_PLP_ID:
tvp->u.data = c->dvbt2_plp_id;
/* Multistream support */
case DTV_STREAM_ID:
case DTV_DVBT2_PLP_ID_LEGACY:
tvp->u.data = c->stream_id;
break;
/* ATSC-MH */
@ -1447,7 +1451,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe,
return r;
}
dtv_property_dump(tvp);
dtv_property_dump(fe, tvp);
return 0;
}
@ -1492,8 +1496,9 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
* DVBv3 system that matches the delivery system.
*/
if (is_dvbv3_delsys(c->delivery_system)) {
dprintk("%s() Using delivery system to %d\n",
__func__, c->delivery_system);
dev_dbg(fe->dvb->device,
"%s: Using delivery system to %d\n",
__func__, c->delivery_system);
return 0;
}
type = dvbv3_type(c->delivery_system);
@ -1511,8 +1516,8 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
desired_system = SYS_DVBT;
break;
default:
dprintk("%s(): This frontend doesn't support DVBv3 calls\n",
__func__);
dev_dbg(fe->dvb->device, "%s: This frontend doesn't support DVBv3 calls\n",
__func__);
return -EINVAL;
}
/*
@ -1534,8 +1539,8 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
ncaps++;
}
if (delsys == SYS_UNDEFINED) {
dprintk("%s() Couldn't find a delivery system that matches %d\n",
__func__, desired_system);
dev_dbg(fe->dvb->device, "%s: Couldn't find a delivery system that matches %d\n",
__func__, desired_system);
}
} else {
/*
@ -1548,8 +1553,9 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) {
if (fe->ops.delsys[ncaps] == desired_system) {
c->delivery_system = desired_system;
dprintk("%s() Changing delivery system to %d\n",
__func__, desired_system);
dev_dbg(fe->dvb->device,
"%s: Changing delivery system to %d\n",
__func__, desired_system);
return 0;
}
ncaps++;
@ -1563,8 +1569,9 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
* DVBv3 delivery systems
*/
if (!is_dvbv3_delsys(desired_system)) {
dprintk("%s() can't use a DVBv3 FE_SET_FRONTEND call on this frontend\n",
__func__);
dev_dbg(fe->dvb->device,
"%s: can't use a DVBv3 FE_SET_FRONTEND call on this frontend\n",
__func__);
return -EINVAL;
}
@ -1581,8 +1588,9 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
}
/* There's nothing compatible with the desired delivery system */
if (delsys == SYS_UNDEFINED) {
dprintk("%s() Incompatible DVBv3 FE_SET_FRONTEND call for this frontend\n",
__func__);
dev_dbg(fe->dvb->device,
"%s: Incompatible DVBv3 FE_SET_FRONTEND call for this frontend\n",
__func__);
return -EINVAL;
}
}
@ -1593,13 +1601,14 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
* The DVBv3 or DVBv5 call is requesting a different system. So,
* emulation is needed.
*
* Emulate newer delivery systems like ISDBT, DVBT and DMBTH
* Emulate newer delivery systems like ISDBT, DVBT and DTMB
* for older DVBv5 applications. The emulation will try to use
* the auto mode for most things, and will assume that the desired
* delivery system is the last one at the ops.delsys[] array
*/
dprintk("%s() Using delivery system %d emulated as if it were a %d\n",
__func__, delsys, desired_system);
dev_dbg(fe->dvb->device,
"%s: Using delivery system %d emulated as if it were a %d\n",
__func__, delsys, desired_system);
/*
* For now, handles ISDB-T calls. More code may be needed here for the
@ -1607,8 +1616,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
*/
if (type == DVBV3_OFDM) {
if (c->delivery_system == SYS_ISDBT) {
dprintk("%s() Using defaults for SYS_ISDBT\n",
__func__);
dev_dbg(fe->dvb->device,
"%s: Using defaults for SYS_ISDBT\n",
__func__);
if (!c->bandwidth_hz)
c->bandwidth_hz = 6000000;
@ -1626,7 +1637,8 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
}
}
}
dprintk("change delivery system on cache to %d\n", c->delivery_system);
dev_dbg(fe->dvb->device, "%s: change delivery system on cache to %d\n",
__func__, c->delivery_system);
return 0;
}
@ -1659,7 +1671,8 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
* ioctl.
*/
c->state = tvp->cmd;
dprintk("%s() Finalised property cache\n", __func__);
dev_dbg(fe->dvb->device, "%s: Finalised property cache\n",
__func__);
r = dtv_set_frontend(fe);
break;
@ -1715,6 +1728,13 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
case DTV_HIERARCHY:
c->hierarchy = tvp->u.data;
break;
case DTV_INTERLEAVING:
c->interleaving = tvp->u.data;
break;
case DTV_LNA:
if (fe->ops.set_lna)
r = fe->ops.set_lna(fe, tvp->u.data);
break;
/* ISDB-T Support here */
case DTV_ISDBT_PARTIAL_RECEPTION:
@ -1771,11 +1791,11 @@ static int dtv_property_process_set(struct dvb_frontend *fe,
case DTV_ISDBT_LAYERC_TIME_INTERLEAVING:
c->layer[2].interleaving = tvp->u.data;
break;
case DTV_ISDBS_TS_ID:
c->isdbs_ts_id = tvp->u.data;
break;
case DTV_DVBT2_PLP_ID:
c->dvbt2_plp_id = tvp->u.data;
/* Multistream support */
case DTV_STREAM_ID:
case DTV_DVBT2_PLP_ID_LEGACY:
c->stream_id = tvp->u.data;
break;
/* ATSC-MH */
@ -1800,10 +1820,9 @@ static int dvb_frontend_ioctl(struct file *file,
struct dvb_frontend *fe = dvbdev->priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct dvb_frontend_private *fepriv = fe->frontend_priv;
int err = -EOPNOTSUPP;
dprintk("%s (%d)\n", __func__, _IOC_NR(cmd));
int err = -ENOTTY;
dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd));
if (fepriv->exit != DVB_FE_NO_EXIT)
return -ENODEV;
@ -1839,13 +1858,13 @@ static int dvb_frontend_ioctl_properties(struct file *file,
struct dtv_property *tvp = NULL;
int i;
dprintk("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if(cmd == FE_SET_PROPERTY) {
tvps = (struct dtv_properties __user *)parg;
dprintk("%s() properties.num = %d\n", __func__, tvps->num);
dprintk("%s() properties.props = %p\n", __func__, tvps->props);
dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num);
dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props);
/* Put an arbitrary limit on the number of messages that can
* be sent at once */
@ -1871,14 +1890,14 @@ static int dvb_frontend_ioctl_properties(struct file *file,
}
if (c->state == DTV_TUNE)
dprintk("%s() Property cache is full, tuning\n", __func__);
dev_dbg(fe->dvb->device, "%s: Property cache is full, tuning\n", __func__);
} else
if(cmd == FE_GET_PROPERTY) {
tvps = (struct dtv_properties __user *)parg;
dprintk("%s() properties.num = %d\n", __func__, tvps->num);
dprintk("%s() properties.props = %p\n", __func__, tvps->props);
dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", __func__, tvps->num);
dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", __func__, tvps->props);
/* Put an arbitrary limit on the number of messages that can
* be sent at once */
@ -1919,7 +1938,7 @@ static int dvb_frontend_ioctl_properties(struct file *file,
}
} else
err = -EOPNOTSUPP;
err = -ENOTTY;
out:
kfree(tvp);
@ -2012,7 +2031,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
case SYS_DVBT:
case SYS_DVBT2:
case SYS_ISDBT:
case SYS_DMBTH:
case SYS_DTMB:
fepriv->min_delay = HZ / 20;
fepriv->step_size = fe->ops.info.frequency_stepsize * 2;
fepriv->max_drift = (fe->ops.info.frequency_stepsize * 2) + 1;
@ -2052,18 +2071,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
struct dvb_frontend *fe = dvbdev->priv;
struct dvb_frontend_private *fepriv = fe->frontend_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int cb_err, err = -EOPNOTSUPP;
if (fe->dvb->fe_ioctl_override) {
cb_err = fe->dvb->fe_ioctl_override(fe, cmd, parg,
DVB_FE_IOCTL_PRE);
if (cb_err < 0)
return cb_err;
if (cb_err > 0)
return 0;
/* fe_ioctl_override returning 0 allows
* dvb-core to continue handling the ioctl */
}
int err = -ENOTTY;
switch (cmd) {
case FE_GET_INFO: {
@ -2097,13 +2105,13 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
info->type = FE_OFDM;
break;
default:
printk(KERN_ERR
"%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
__func__, c->delivery_system);
dev_err(fe->dvb->device,
"%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
__func__, c->delivery_system);
fe->ops.info.type = FE_OFDM;
}
dprintk("current delivery system on cache: %d, V3 type: %d\n",
c->delivery_system, fe->ops.info.type);
dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n",
__func__, c->delivery_system, fe->ops.info.type);
/* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't
* do it, it is done for it. */
@ -2128,27 +2136,43 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
err = fe->ops.read_status(fe, status);
break;
}
case FE_READ_BER:
if (fe->ops.read_ber)
err = fe->ops.read_ber(fe, (__u32*) parg);
if (fe->ops.read_ber) {
if (fepriv->thread)
err = fe->ops.read_ber(fe, (__u32 *) parg);
else
err = -EAGAIN;
}
break;
case FE_READ_SIGNAL_STRENGTH:
if (fe->ops.read_signal_strength)
err = fe->ops.read_signal_strength(fe, (__u16*) parg);
if (fe->ops.read_signal_strength) {
if (fepriv->thread)
err = fe->ops.read_signal_strength(fe, (__u16 *) parg);
else
err = -EAGAIN;
}
break;
case FE_READ_SNR:
if (fe->ops.read_snr)
err = fe->ops.read_snr(fe, (__u16*) parg);
if (fe->ops.read_snr) {
if (fepriv->thread)
err = fe->ops.read_snr(fe, (__u16 *) parg);
else
err = -EAGAIN;
}
break;
case FE_READ_UNCORRECTED_BLOCKS:
if (fe->ops.read_ucblocks)
err = fe->ops.read_ucblocks(fe, (__u32*) parg);
if (fe->ops.read_ucblocks) {
if (fepriv->thread)
err = fe->ops.read_ucblocks(fe, (__u32 *) parg);
else
err = -EAGAIN;
}
break;
case FE_DISEQC_RESET_OVERLOAD:
if (fe->ops.diseqc_reset_overload) {
err = fe->ops.diseqc_reset_overload(fe);
@ -2287,13 +2311,6 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
break;
};
if (fe->dvb->fe_ioctl_override) {
cb_err = fe->dvb->fe_ioctl_override(fe, cmd, parg,
DVB_FE_IOCTL_POST);
if (cb_err < 0)
return cb_err;
}
return err;
}
@ -2304,7 +2321,7 @@ static unsigned int dvb_frontend_poll(struct file *file, struct poll_table_struc
struct dvb_frontend *fe = dvbdev->priv;
struct dvb_frontend_private *fepriv = fe->frontend_priv;
dprintk ("%s\n", __func__);
dev_dbg_ratelimited(fe->dvb->device, "%s:\n", __func__);
poll_wait (file, &fepriv->events.wait_queue, wait);
@ -2322,7 +2339,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
struct dvb_adapter *adapter = fe->dvb;
int ret;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if (fepriv->exit == DVB_FE_DEVICE_REMOVED)
return -ENODEV;
@ -2417,7 +2434,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
struct dvb_frontend_private *fepriv = fe->frontend_priv;
int ret;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
fepriv->release_jiffies = jiffies;
@ -2449,6 +2466,44 @@ static const struct file_operations dvb_frontend_fops = {
.llseek = noop_llseek,
};
int dvb_frontend_suspend(struct dvb_frontend *fe)
{
int ret = 0;
dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
fe->id);
if (fe->ops.tuner_ops.sleep)
ret = fe->ops.tuner_ops.sleep(fe);
if (fe->ops.sleep)
ret = fe->ops.sleep(fe);
return ret;
}
EXPORT_SYMBOL(dvb_frontend_suspend);
int dvb_frontend_resume(struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
int ret = 0;
dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
fe->id);
if (fe->ops.init)
ret = fe->ops.init(fe);
if (fe->ops.tuner_ops.init)
ret = fe->ops.tuner_ops.init(fe);
fepriv->state = FESTATE_RETUNE;
dvb_frontend_wakeup(fe);
return ret;
}
EXPORT_SYMBOL(dvb_frontend_resume);
int dvb_register_frontend(struct dvb_adapter* dvb,
struct dvb_frontend* fe)
{
@ -2461,7 +2516,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
.kernel_ioctl = dvb_frontend_ioctl
};
dprintk ("%s\n", __func__);
dev_dbg(dvb->device, "%s:\n", __func__);
if (mutex_lock_interruptible(&frontend_mutex))
return -ERESTARTSYS;
@ -2480,10 +2535,9 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
fe->dvb = dvb;
fepriv->inversion = INVERSION_OFF;
printk ("DVB: registering adapter %i frontend %i (%s)...\n",
fe->dvb->num,
fe->id,
fe->ops.info.name);
dev_info(fe->dvb->device,
"DVB: registering adapter %i frontend %i (%s)...\n",
fe->dvb->num, fe->id, fe->ops.info.name);
dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template,
fe, DVB_DEVICE_FRONTEND);
@ -2504,7 +2558,7 @@ EXPORT_SYMBOL(dvb_register_frontend);
int dvb_unregister_frontend(struct dvb_frontend* fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;
dprintk ("%s\n", __func__);
dev_dbg(fe->dvb->device, "%s:\n", __func__);
mutex_lock(&frontend_mutex);
dvb_frontend_stop (fe);

View file

@ -303,6 +303,7 @@ struct dvb_frontend_ops {
int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire);
int (*set_lna)(struct dvb_frontend *, int);
/* These callbacks are for devices that implement their own
* tuning algorithms, rather than a simple swzigzag
@ -354,6 +355,8 @@ struct dtv_frontend_properties {
fe_delivery_system_t delivery_system;
enum fe_interleaving interleaving;
/* ISDB-T specifics */
u8 isdbt_partial_reception;
u8 isdbt_sb_mode;
@ -368,11 +371,8 @@ struct dtv_frontend_properties {
u8 interleaving;
} layer[3];
/* ISDB-T specifics */
u32 isdbs_ts_id;
/* DVB-T2 specifics */
u32 dvbt2_plp_id;
/* Multistream specifics */
u32 stream_id;
/* ATSC-MH specifics */
u8 atscmh_fic_ver;
@ -416,6 +416,8 @@ extern int dvb_unregister_frontend(struct dvb_frontend *fe);
extern void dvb_frontend_detach(struct dvb_frontend *fe);
extern void dvb_frontend_reinitialise(struct dvb_frontend *fe);
extern int dvb_frontend_suspend(struct dvb_frontend *fe);
extern int dvb_frontend_resume(struct dvb_frontend *fe);
extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec);
extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime);

View file

@ -420,7 +420,7 @@ int dvb_usercopy(struct file *file,
/* call driver */
mutex_lock(&dvbdev_mutex);
if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
err = -EINVAL;
err = -ENOTTY;
mutex_unlock(&dvbdev_mutex);
if (err < 0)

View file

@ -71,32 +71,6 @@ struct dvb_adapter {
int mfe_shared; /* indicates mutually exclusive frontends */
struct dvb_device *mfe_dvbdev; /* frontend device in use */
struct mutex mfe_lock; /* access lock for thread creation */
/* Allow the adapter/bridge driver to perform an action before and/or
* after the core handles an ioctl:
*
* DVB_FE_IOCTL_PRE indicates that the ioctl has not yet been handled.
* DVB_FE_IOCTL_POST indicates that the ioctl has been handled.
*
* When DVB_FE_IOCTL_PRE is passed to the callback as the stage arg:
*
* return 0 to allow dvb-core to handle the ioctl.
* return a positive int to prevent dvb-core from handling the ioctl,
* and exit without error.
* return a negative int to prevent dvb-core from handling the ioctl,
* and return that value as an error.
*
* When DVB_FE_IOCTL_POST is passed to the callback as the stage arg:
*
* return 0 to allow the dvb_frontend ioctl handler to exit normally.
* return a negative int to cause the dvb_frontend ioctl handler to
* return that value as an error.
*/
#define DVB_FE_IOCTL_PRE 0
#define DVB_FE_IOCTL_POST 1
int (*fe_ioctl_override)(struct dvb_frontend *fe,
unsigned int cmd, void *parg,
unsigned int stage);
};

View file

@ -1,20 +1,5 @@
config DVB_FE_CUSTOMISE
bool "Customise the frontend modules to build"
depends on DVB_CORE
depends on EXPERT
default y if EXPERT
help
This allows the user to select/deselect frontend drivers for their
hardware from the build.
Use this option with care as deselecting frontends which are in fact
necessary will result in DVB devices which cannot be tuned due to lack
of driver support.
If unsure say N.
menu "Customise DVB Frontends"
visible if DVB_FE_CUSTOMISE
visible if !MEDIA_SUBDRV_AUTOSELECT
comment "Multistandard (satellite) frontends"
depends on DVB_CORE
@ -22,7 +7,7 @@ comment "Multistandard (satellite) frontends"
config DVB_STB0899
tristate "STB0899 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S/S2/DSS Multistandard demodulator. Say Y when you want
to support this demodulator based frontends
@ -30,7 +15,7 @@ config DVB_STB0899
config DVB_STB6100
tristate "STB6100 based tuners"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A Silicon tuner from ST used in conjunction with the STB0899
demodulator. Say Y when you want to support this tuner.
@ -38,7 +23,7 @@ config DVB_STB6100
config DVB_STV090x
tristate "STV0900/STV0903(A/B) based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
DVB-S/S2/DSS Multistandard Professional/Broadcast demodulators.
Say Y when you want to support these frontends.
@ -46,7 +31,7 @@ config DVB_STV090x
config DVB_STV6110x
tristate "STV6110/(A) based tuners"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A Silicon tuner that supports DVB-S and DVB-S2 modes
@ -56,7 +41,7 @@ comment "Multistandard (cable + terrestrial) frontends"
config DVB_DRXK
tristate "Micronas DRXK based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Micronas DRX-K DVB-C/T demodulator.
@ -65,7 +50,7 @@ config DVB_DRXK
config DVB_TDA18271C2DD
tristate "NXP TDA18271C2 silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
NXP TDA18271 silicon tuner.
@ -77,119 +62,119 @@ comment "DVB-S (satellite) frontends"
config DVB_CX24110
tristate "Conexant CX24110 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_CX24123
tristate "Conexant CX24123 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_MT312
tristate "Zarlink VP310/MT312/ZL10313 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_ZL10036
tristate "Zarlink ZL10036 silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_ZL10039
tristate "Zarlink ZL10039 silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_S5H1420
tristate "Samsung S5H1420 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_STV0288
tristate "ST STV0288 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_STB6000
tristate "ST STB6000 silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S silicon tuner module. Say Y when you want to support this tuner.
config DVB_STV0299
tristate "ST STV0299 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_STV6110
tristate "ST STV6110 silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S silicon tuner module. Say Y when you want to support this tuner.
config DVB_STV0900
tristate "ST STV0900 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S/S2 demodulator. Say Y when you want to support this frontend.
config DVB_TDA8083
tristate "Philips TDA8083 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_TDA10086
tristate "Philips TDA10086 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_TDA8261
tristate "Philips TDA8261 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_VES1X93
tristate "VLSI VES1893 or VES1993 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_TUNER_ITD1000
tristate "Integrant ITD1000 Zero IF tuner for DVB-S/DSS"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_TUNER_CX24113
tristate "Conexant CX24113/CX24128 tuner for DVB-S/DSS"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
@ -197,42 +182,42 @@ config DVB_TUNER_CX24113
config DVB_TDA826X
tristate "Philips TDA826X silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S silicon tuner module. Say Y when you want to support this tuner.
config DVB_TUA6100
tristate "Infineon TUA6100 PLL"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S PLL chip.
config DVB_CX24116
tristate "Conexant CX24116 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S/S2 tuner module. Say Y when you want to support this frontend.
config DVB_SI21XX
tristate "Silicon Labs SI21XX based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_DS3000
tristate "Montage Tehnology DS3000 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S/S2 tuner module. Say Y when you want to support this frontend.
config DVB_MB86A16
tristate "Fujitsu MB86A16 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S/DSS Direct Conversion reveiver.
Say Y when you want to support this frontend.
@ -240,7 +225,7 @@ config DVB_MB86A16
config DVB_TDA10071
tristate "NXP TDA10071"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Say Y when you want to support this frontend.
@ -250,7 +235,7 @@ comment "DVB-T (terrestrial) frontends"
config DVB_SP8870
tristate "Spase sp8870 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
@ -262,7 +247,7 @@ config DVB_SP8870
config DVB_SP887X
tristate "Spase sp887x based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
@ -274,28 +259,28 @@ config DVB_SP887X
config DVB_CX22700
tristate "Conexant CX22700 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_CX22702
tristate "Conexant cx22702 demodulator (OFDM)"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_S5H1432
tristate "Samsung s5h1432 demodulator (OFDM)"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_DRXD
tristate "Micronas DRXD driver"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
@ -306,14 +291,14 @@ config DVB_DRXD
config DVB_L64781
tristate "LSI L64781"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_TDA1004X
tristate "Philips TDA10045H/TDA10046H based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
@ -326,28 +311,28 @@ config DVB_TDA1004X
config DVB_NXT6000
tristate "NxtWave Communications NXT6000 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_MT352
tristate "Zarlink MT352 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_ZL10353
tristate "Zarlink ZL10353 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_DIB3000MB
tristate "DiBcom 3000M-B"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Designed for mobile usage. Say Y when you want
to support this frontend.
@ -355,7 +340,7 @@ config DVB_DIB3000MB
config DVB_DIB3000MC
tristate "DiBcom 3000P/M-C"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Designed for mobile usage. Say Y when you want
to support this frontend.
@ -363,7 +348,7 @@ config DVB_DIB3000MC
config DVB_DIB7000M
tristate "DiBcom 7000MA/MB/PA/PB/MC"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Designed for mobile usage. Say Y when you want
to support this frontend.
@ -371,7 +356,7 @@ config DVB_DIB7000M
config DVB_DIB7000P
tristate "DiBcom 7000PC"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Designed for mobile usage. Say Y when you want
to support this frontend.
@ -379,7 +364,7 @@ config DVB_DIB7000P
config DVB_DIB9000
tristate "DiBcom 9000"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Designed for mobile usage. Say Y when you want
to support this frontend.
@ -387,56 +372,56 @@ config DVB_DIB9000
config DVB_TDA10048
tristate "Philips TDA10048HN based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module. Say Y when you want to support this frontend.
config DVB_AF9013
tristate "Afatech AF9013 demodulator"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Say Y when you want to support this frontend.
config DVB_EC100
tristate "E3C EC100"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Say Y when you want to support this frontend.
config DVB_HD29L2
tristate "HDIC HD29L2"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Say Y when you want to support this frontend.
config DVB_STV0367
tristate "ST STV0367 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T/C tuner module. Say Y when you want to support this frontend.
config DVB_CXD2820R
tristate "Sony CXD2820R"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Say Y when you want to support this frontend.
config DVB_RTL2830
tristate "Realtek RTL2830 DVB-T"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Say Y when you want to support this frontend.
config DVB_RTL2832
tristate "Realtek RTL2832 DVB-T"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Say Y when you want to support this frontend.
@ -446,28 +431,28 @@ comment "DVB-C (cable) frontends"
config DVB_VES1820
tristate "VLSI VES1820 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-C tuner module. Say Y when you want to support this frontend.
config DVB_TDA10021
tristate "Philips TDA10021 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-C tuner module. Say Y when you want to support this frontend.
config DVB_TDA10023
tristate "Philips TDA10023 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-C tuner module. Say Y when you want to support this frontend.
config DVB_STV0297
tristate "ST STV0297 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-C tuner module. Say Y when you want to support this frontend.
@ -477,7 +462,7 @@ comment "ATSC (North American/Korean Terrestrial/Cable DTV) frontends"
config DVB_NXT200X
tristate "NxtWave Communications NXT2002/NXT2004 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
@ -491,7 +476,7 @@ config DVB_NXT200X
config DVB_OR51211
tristate "Oren OR51211 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
@ -503,7 +488,7 @@ config DVB_OR51211
config DVB_OR51132
tristate "Oren OR51132 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
@ -518,7 +503,7 @@ config DVB_OR51132
config DVB_BCM3510
tristate "Broadcom BCM3510"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to
support this frontend.
@ -526,7 +511,7 @@ config DVB_BCM3510
config DVB_LGDT330X
tristate "LG Electronics LGDT3302/LGDT3303 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
@ -534,7 +519,7 @@ config DVB_LGDT330X
config DVB_LGDT3305
tristate "LG Electronics LGDT3304 and LGDT3305 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
@ -542,7 +527,7 @@ config DVB_LGDT3305
config DVB_LG2160
tristate "LG Electronics LG216x based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC/MH demodulator module. Say Y when you want
to support this frontend.
@ -550,7 +535,7 @@ config DVB_LG2160
config DVB_S5H1409
tristate "Samsung S5H1409 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
@ -563,7 +548,7 @@ config DVB_AU8522_DTV
tristate "Auvitek AU8522 based DTV demod"
depends on DVB_CORE && I2C
select DVB_AU8522
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB, QAM64/256 & NTSC demodulator module. Say Y when
you want to enable DTV demodulation support for this frontend.
@ -572,7 +557,7 @@ config DVB_AU8522_V4L
tristate "Auvitek AU8522 based ATV demod"
depends on VIDEO_V4L2 && I2C
select DVB_AU8522
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB, QAM64/256 & NTSC demodulator module. Say Y when
you want to enable ATV demodulation support for this frontend.
@ -580,7 +565,7 @@ config DVB_AU8522_V4L
config DVB_S5H1411
tristate "Samsung S5H1411 based"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend.
@ -591,7 +576,7 @@ comment "ISDB-T (terrestrial) frontends"
config DVB_S921
tristate "Sharp S921 frontend"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
AN ISDB-T DQPSK, QPSK, 16QAM and 64QAM 1seg tuner module.
Say Y when you want to support this frontend.
@ -599,7 +584,7 @@ config DVB_S921
config DVB_DIB8000
tristate "DiBcom 8000MB/MC"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A driver for DiBcom's DiB8000 ISDB-T/ISDB-Tsb demodulator.
Say Y when you want to support this frontend.
@ -607,7 +592,7 @@ config DVB_DIB8000
config DVB_MB86A20S
tristate "Fujitsu mb86a20s"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A driver for Fujitsu mb86a20s ISDB-T/ISDB-Tsb demodulator.
Say Y when you want to support this frontend.
@ -618,7 +603,7 @@ comment "Digital terrestrial only tuners/PLL"
config DVB_PLL
tristate "Generic I2C PLL based tuners"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
This module drives a number of tuners based on PLL chips with a
common I2C interface. Say Y when you want to support these tuners.
@ -626,7 +611,7 @@ config DVB_PLL
config DVB_TUNER_DIB0070
tristate "DiBcom DiB0070 silicon base-band tuner"
depends on I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A driver for the silicon baseband tuner DiB0070 from DiBcom.
This device is only used inside a SiP called together with a
@ -635,7 +620,7 @@ config DVB_TUNER_DIB0070
config DVB_TUNER_DIB0090
tristate "DiBcom DiB0090 silicon base-band tuner"
depends on I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A driver for the silicon baseband tuner DiB0090 from DiBcom.
This device is only used inside a SiP called together with a
@ -647,14 +632,14 @@ comment "SEC control devices for DVB-S"
config DVB_LNBP21
tristate "LNBP21/LNBH24 SEC controllers"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An SEC control chips.
config DVB_LNBP22
tristate "LNBP22 SEC controllers"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
LNB power supply and control voltage
regulator chip with step-up converter
@ -664,33 +649,33 @@ config DVB_LNBP22
config DVB_ISL6405
tristate "ISL6405 SEC controller"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An SEC control chip.
config DVB_ISL6421
tristate "ISL6421 SEC controller"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
An SEC control chip.
config DVB_ISL6423
tristate "ISL6423 SEC controller"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A SEC controller chip from Intersil
config DVB_A8293
tristate "Allegro A8293"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
config DVB_LGS8GL5
tristate "Silicon Legend LGS-8GL5 demodulator (OFDM)"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DMB-TH tuner module. Say Y when you want to support this frontend.
@ -698,21 +683,21 @@ config DVB_LGS8GXX
tristate "Legend Silicon LGS8913/LGS8GL5/LGS8GXX DMB-TH demodulator"
depends on DVB_CORE && I2C
select FW_LOADER
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DMB-TH tuner module. Say Y when you want to support this frontend.
config DVB_ATBM8830
tristate "AltoBeam ATBM8830/8831 DMB-TH demodulator"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DMB-TH tuner module. Say Y when you want to support this frontend.
config DVB_TDA665x
tristate "TDA665x tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
Support for tuner modules based on Philips TDA6650/TDA6651 chips.
Say Y when you want to support this chip.
@ -723,14 +708,14 @@ config DVB_TDA665x
config DVB_IX2505V
tristate "Sharp IX2505V silicon tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module. Say Y when you want to support this frontend.
config DVB_IT913X_FE
tristate "it913x frontend and it9137 tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-T tuner module.
Say Y when you want to support this frontend.
@ -738,7 +723,7 @@ config DVB_IT913X_FE
config DVB_M88RS2000
tristate "M88RS2000 DVB-S demodulator and tuner"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
help
A DVB-S tuner module.
Say Y when you want to support this frontend.
@ -746,7 +731,7 @@ config DVB_M88RS2000
config DVB_AF9033
tristate "Afatech AF9033 DVB-T demodulator"
depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE
default m if !MEDIA_SUBDRV_AUTOSELECT
comment "Tools to develop new frontends"

View file

@ -2,13 +2,13 @@
# Makefile for the kernel DVB frontend device drivers.
#
ccflags-y += -I$(srctree)/drivers/media/dvb/dvb-core/
ccflags-y += -I$(srctree)/drivers/media/common/tuners/
ccflags-y += -I$(srctree)/drivers/media/dvb-core/
ccflags-y += -I$(srctree)/drivers/media/tuners/
stb0899-objs = stb0899_drv.o stb0899_algo.o
stv0900-objs = stv0900_core.o stv0900_sw.o
drxd-objs = drxd_firm.o drxd_hard.o
cxd2820r-objs = cxd2820r_core.o cxd2820r_c.o cxd2820r_t.o cxd2820r_t2.o
stb0899-objs := stb0899_drv.o stb0899_algo.o
stv0900-objs := stv0900_core.o stv0900_sw.o
drxd-objs := drxd_firm.o drxd_hard.o
cxd2820r-objs := cxd2820r_core.o cxd2820r_c.o cxd2820r_t.o cxd2820r_t2.o
drxk-objs := drxk_hard.o
obj-$(CONFIG_DVB_PLL) += dvb-pll.o

View file

@ -24,10 +24,6 @@
#include "af9013_priv.h"
int af9013_debug;
module_param_named(debug, af9013_debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
struct af9013_state {
struct i2c_adapter *i2c;
struct dvb_frontend fe;
@ -73,7 +69,8 @@ static int af9013_wr_regs_i2c(struct af9013_state *priv, u8 mbox, u16 reg,
if (ret == 1) {
ret = 0;
} else {
warn("i2c wr failed=%d reg=%04x len=%d", ret, reg, len);
dev_warn(&priv->i2c->dev, "%s: i2c wr failed=%d reg=%04x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
return ret;
@ -107,7 +104,8 @@ static int af9013_rd_regs_i2c(struct af9013_state *priv, u8 mbox, u16 reg,
if (ret == 2) {
ret = 0;
} else {
warn("i2c rd failed=%d reg=%04x len=%d", ret, reg, len);
dev_warn(&priv->i2c->dev, "%s: i2c rd failed=%d reg=%04x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
return ret;
@ -220,7 +218,8 @@ static int af9013_set_gpio(struct af9013_state *state, u8 gpio, u8 gpioval)
u8 pos;
u16 addr;
dbg("%s: gpio=%d gpioval=%02x", __func__, gpio, gpioval);
dev_dbg(&state->i2c->dev, "%s: gpio=%d gpioval=%02x\n",
__func__, gpio, gpioval);
/*
* GPIO0 & GPIO1 0xd735
@ -238,7 +237,8 @@ static int af9013_set_gpio(struct af9013_state *state, u8 gpio, u8 gpioval)
break;
default:
err("invalid gpio:%d\n", gpio);
dev_err(&state->i2c->dev, "%s: invalid gpio=%d\n",
KBUILD_MODNAME, gpio);
ret = -EINVAL;
goto err;
};
@ -261,15 +261,15 @@ static int af9013_set_gpio(struct af9013_state *state, u8 gpio, u8 gpioval)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
static u32 af913_div(u32 a, u32 b, u32 x)
static u32 af9013_div(struct af9013_state *state, u32 a, u32 b, u32 x)
{
u32 r = 0, c = 0, i;
dbg("%s: a=%d b=%d x=%d", __func__, a, b, x);
dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d\n", __func__, a, b, x);
if (a > b) {
c = a / b;
@ -286,7 +286,9 @@ static u32 af913_div(u32 a, u32 b, u32 x)
}
r = (c << (u32)x) + r;
dbg("%s: a=%d b=%d x=%d r=%x", __func__, a, b, x, r);
dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d r=%d r=%x\n",
__func__, a, b, x, r, r);
return r;
}
@ -295,7 +297,7 @@ static int af9013_power_ctrl(struct af9013_state *state, u8 onoff)
int ret, i;
u8 tmp;
dbg("%s: onoff=%d", __func__, onoff);
dev_dbg(&state->i2c->dev, "%s: onoff=%d\n", __func__, onoff);
/* enable reset */
ret = af9013_wr_reg_bits(state, 0xd417, 4, 1, 1);
@ -340,7 +342,7 @@ static int af9013_power_ctrl(struct af9013_state *state, u8 onoff)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -349,7 +351,7 @@ static int af9013_statistics_ber_unc_start(struct dvb_frontend *fe)
struct af9013_state *state = fe->demodulator_priv;
int ret;
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* reset and start BER counter */
ret = af9013_wr_reg_bits(state, 0xd391, 4, 1, 1);
@ -358,7 +360,7 @@ static int af9013_statistics_ber_unc_start(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -368,7 +370,7 @@ static int af9013_statistics_ber_unc_result(struct dvb_frontend *fe)
int ret;
u8 buf[5];
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* check if error bit count is ready */
ret = af9013_rd_reg_bits(state, 0xd391, 4, 1, &buf[0]);
@ -376,7 +378,7 @@ static int af9013_statistics_ber_unc_result(struct dvb_frontend *fe)
goto err;
if (!buf[0]) {
dbg("%s: not ready", __func__);
dev_dbg(&state->i2c->dev, "%s: not ready\n", __func__);
return 0;
}
@ -389,7 +391,7 @@ static int af9013_statistics_ber_unc_result(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -398,7 +400,7 @@ static int af9013_statistics_snr_start(struct dvb_frontend *fe)
struct af9013_state *state = fe->demodulator_priv;
int ret;
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* start SNR meas */
ret = af9013_wr_reg_bits(state, 0xd2e1, 3, 1, 1);
@ -407,7 +409,7 @@ static int af9013_statistics_snr_start(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -419,7 +421,7 @@ static int af9013_statistics_snr_result(struct dvb_frontend *fe)
u32 snr_val;
const struct af9013_snr *uninitialized_var(snr_lut);
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* check if SNR ready */
ret = af9013_rd_reg_bits(state, 0xd2e1, 3, 1, &tmp);
@ -427,7 +429,7 @@ static int af9013_statistics_snr_result(struct dvb_frontend *fe)
goto err;
if (!tmp) {
dbg("%s: not ready", __func__);
dev_dbg(&state->i2c->dev, "%s: not ready\n", __func__);
return 0;
}
@ -471,7 +473,7 @@ static int af9013_statistics_snr_result(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -482,7 +484,7 @@ static int af9013_statistics_signal_strength(struct dvb_frontend *fe)
u8 buf[2], rf_gain, if_gain;
int signal_strength;
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
if (!state->signal_strength_en)
return 0;
@ -508,7 +510,7 @@ static int af9013_statistics_signal_strength(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -578,8 +580,8 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
u8 buf[6];
u32 if_frequency, freq_cw;
dbg("%s: frequency=%d bandwidth_hz=%d", __func__,
c->frequency, c->bandwidth_hz);
dev_dbg(&state->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n",
__func__, c->frequency, c->bandwidth_hz);
/* program tuner */
if (fe->ops.tuner_ops.set_params)
@ -606,6 +608,9 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
else
if_frequency = state->config.if_frequency;
dev_dbg(&state->i2c->dev, "%s: if_frequency=%d\n",
__func__, if_frequency);
sampling_freq = if_frequency;
while (sampling_freq > (state->config.clock / 2))
@ -618,7 +623,8 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
spec_inv = !state->config.spec_inv;
}
freq_cw = af913_div(sampling_freq, state->config.clock, 23);
freq_cw = af9013_div(state, sampling_freq, state->config.clock,
23);
if (spec_inv)
freq_cw = 0x800000 - freq_cw;
@ -676,7 +682,8 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
buf[0] |= (1 << 0);
break;
default:
dbg("%s: invalid transmission_mode", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid transmission_mode\n",
__func__);
auto_mode = 1;
}
@ -696,7 +703,8 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
buf[0] |= (3 << 2);
break;
default:
dbg("%s: invalid guard_interval", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid guard_interval\n",
__func__);
auto_mode = 1;
}
@ -716,7 +724,7 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
buf[0] |= (3 << 4);
break;
default:
dbg("%s: invalid hierarchy", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid hierarchy\n", __func__);
auto_mode = 1;
};
@ -733,7 +741,7 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
buf[1] |= (2 << 6);
break;
default:
dbg("%s: invalid modulation", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid modulation\n", __func__);
auto_mode = 1;
}
@ -759,7 +767,8 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
buf[2] |= (4 << 0);
break;
default:
dbg("%s: invalid code_rate_HP", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid code_rate_HP\n",
__func__);
auto_mode = 1;
}
@ -784,7 +793,8 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
case FEC_NONE:
break;
default:
dbg("%s: invalid code_rate_LP", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid code_rate_LP\n",
__func__);
auto_mode = 1;
}
@ -798,7 +808,8 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
buf[1] |= (2 << 2);
break;
default:
dbg("%s: invalid bandwidth_hz", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid bandwidth_hz\n",
__func__);
ret = -EINVAL;
goto err;
}
@ -813,7 +824,7 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
dbg("%s: auto params", __func__);
dev_dbg(&state->i2c->dev, "%s: auto params\n", __func__);
} else {
/* set easy mode flag */
ret = af9013_wr_reg(state, 0xaefd, 1);
@ -824,7 +835,7 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
dbg("%s: manual params", __func__);
dev_dbg(&state->i2c->dev, "%s: manual params\n", __func__);
}
/* tune */
@ -838,7 +849,7 @@ static int af9013_set_frontend(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -849,7 +860,7 @@ static int af9013_get_frontend(struct dvb_frontend *fe)
int ret;
u8 buf[3];
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
ret = af9013_rd_regs(state, 0xd3c0, buf, 3);
if (ret)
@ -955,7 +966,7 @@ static int af9013_get_frontend(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -1005,7 +1016,7 @@ static int af9013_read_status(struct dvb_frontend *fe, fe_status_t *status)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -1045,7 +1056,7 @@ static int af9013_init(struct dvb_frontend *fe)
u32 adc_cw;
const struct af9013_reg_bit *init;
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* power on */
ret = af9013_power_ctrl(state, 1);
@ -1077,11 +1088,12 @@ static int af9013_init(struct dvb_frontend *fe)
tmp = 3;
break;
default:
err("invalid clock");
dev_err(&state->i2c->dev, "%s: invalid clock\n",
KBUILD_MODNAME);
return -EINVAL;
}
adc_cw = af913_div(state->config.clock, 1000000ul, 19);
adc_cw = af9013_div(state, state->config.clock, 1000000ul, 19);
buf[0] = (adc_cw >> 0) & 0xff;
buf[1] = (adc_cw >> 8) & 0xff;
buf[2] = (adc_cw >> 16) & 0xff;
@ -1137,7 +1149,7 @@ static int af9013_init(struct dvb_frontend *fe)
goto err;
/* load OFSM settings */
dbg("%s: load ofsm settings", __func__);
dev_dbg(&state->i2c->dev, "%s: load ofsm settings\n", __func__);
len = ARRAY_SIZE(ofsm_init);
init = ofsm_init;
for (i = 0; i < len; i++) {
@ -1148,7 +1160,8 @@ static int af9013_init(struct dvb_frontend *fe)
}
/* load tuner specific settings */
dbg("%s: load tuner specific settings", __func__);
dev_dbg(&state->i2c->dev, "%s: load tuner specific settings\n",
__func__);
switch (state->config.tuner) {
case AF9013_TUNER_MXL5003D:
len = ARRAY_SIZE(tuner_init_mxl5003d);
@ -1259,7 +1272,7 @@ static int af9013_init(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -1268,7 +1281,7 @@ static int af9013_sleep(struct dvb_frontend *fe)
struct af9013_state *state = fe->demodulator_priv;
int ret;
dbg("%s", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* stop statistics polling */
cancel_delayed_work_sync(&state->statistics_work);
@ -1285,7 +1298,7 @@ static int af9013_sleep(struct dvb_frontend *fe)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -1294,7 +1307,7 @@ static int af9013_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
int ret;
struct af9013_state *state = fe->demodulator_priv;
dbg("%s: enable=%d", __func__, enable);
dev_dbg(&state->i2c->dev, "%s: enable=%d\n", __func__, enable);
/* gate already open or close */
if (state->i2c_gate_state == enable)
@ -1311,7 +1324,7 @@ static int af9013_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
return ret;
err:
dbg("%s: failed=%d", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -1330,7 +1343,7 @@ static int af9013_download_firmware(struct af9013_state *state)
u16 checksum = 0;
u8 val;
u8 fw_params[4];
u8 *fw_file = AF9013_DEFAULT_FIRMWARE;
u8 *fw_file = AF9013_FIRMWARE;
msleep(100);
/* check whether firmware is already running */
@ -1338,25 +1351,28 @@ static int af9013_download_firmware(struct af9013_state *state)
if (ret)
goto err;
else
dbg("%s: firmware status=%02x", __func__, val);
dev_dbg(&state->i2c->dev, "%s: firmware status=%02x\n",
__func__, val);
if (val == 0x0c) /* fw is running, no need for download */
goto exit;
info("found a '%s' in cold state, will try to load a firmware",
af9013_ops.info.name);
dev_info(&state->i2c->dev, "%s: found a '%s' in cold state, will try " \
"to load a firmware\n",
KBUILD_MODNAME, af9013_ops.info.name);
/* request the firmware, this will block and timeout */
ret = request_firmware(&fw, fw_file, state->i2c->dev.parent);
if (ret) {
err("did not find the firmware file. (%s) "
"Please see linux/Documentation/dvb/ for more details" \
" on firmware-problems. (%d)",
fw_file, ret);
dev_info(&state->i2c->dev, "%s: did not find the firmware " \
"file. (%s) Please see linux/Documentation/dvb/ for " \
"more details on firmware-problems. (%d)\n",
KBUILD_MODNAME, fw_file, ret);
goto err;
}
info("downloading firmware from file '%s'", fw_file);
dev_info(&state->i2c->dev, "%s: downloading firmware from file '%s'\n",
KBUILD_MODNAME, fw_file);
/* calc checksum */
for (i = 0; i < fw->size; i++)
@ -1384,7 +1400,9 @@ static int af9013_download_firmware(struct af9013_state *state)
FW_ADDR + fw->size - remaining,
(u8 *) &fw->data[fw->size - remaining], len);
if (ret) {
err("firmware download failed:%d", ret);
dev_err(&state->i2c->dev,
"%s: firmware download failed=%d\n",
KBUILD_MODNAME, ret);
goto err_release;
}
}
@ -1402,17 +1420,20 @@ static int af9013_download_firmware(struct af9013_state *state)
if (ret)
goto err_release;
dbg("%s: firmware status=%02x", __func__, val);
dev_dbg(&state->i2c->dev, "%s: firmware status=%02x\n",
__func__, val);
if (val == 0x0c || val == 0x04) /* success or fail */
break;
}
if (val == 0x04) {
err("firmware did not run");
dev_err(&state->i2c->dev, "%s: firmware did not run\n",
KBUILD_MODNAME);
ret = -ENODEV;
} else if (val != 0x0c) {
err("firmware boot timeout");
dev_err(&state->i2c->dev, "%s: firmware boot timeout\n",
KBUILD_MODNAME);
ret = -ENODEV;
}
@ -1421,7 +1442,8 @@ err_release:
err:
exit:
if (!ret)
info("found a '%s' in warm state.", af9013_ops.info.name);
dev_info(&state->i2c->dev, "%s: found a '%s' in warm state\n",
KBUILD_MODNAME, af9013_ops.info.name);
return ret;
}
@ -1453,7 +1475,8 @@ struct dvb_frontend *af9013_attach(const struct af9013_config *config,
if (ret)
goto err;
info("firmware version %d.%d.%d.%d", buf[0], buf[1], buf[2], buf[3]);
dev_info(&state->i2c->dev, "%s: firmware version %d.%d.%d.%d\n",
KBUILD_MODNAME, buf[0], buf[1], buf[2], buf[3]);
/* set GPIOs */
for (i = 0; i < sizeof(state->config.gpio); i++) {
@ -1522,3 +1545,4 @@ static struct dvb_frontend_ops af9013_ops = {
MODULE_AUTHOR("Antti Palosaari <[email protected]>");
MODULE_DESCRIPTION("Afatech AF9013 DVB-T demodulator driver");
MODULE_LICENSE("GPL");
MODULE_FIRMWARE(AF9013_FIRMWARE);

View file

@ -110,7 +110,7 @@ extern struct dvb_frontend *af9013_attach(const struct af9013_config *config,
static inline struct dvb_frontend *af9013_attach(
const struct af9013_config *config, struct i2c_adapter *i2c)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
pr_warn("%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif /* CONFIG_DVB_AF9013 */

View file

@ -29,20 +29,7 @@
#include "af9013.h"
#include <linux/firmware.h>
#define LOG_PREFIX "af9013"
#undef dbg
#define dbg(f, arg...) \
if (af9013_debug) \
printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef err
#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
#undef info
#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef warn
#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
#define AF9013_DEFAULT_FIRMWARE "dvb-fe-af9013.fw"
#define AF9013_FIRMWARE "dvb-fe-af9013.fw"
struct af9013_reg_bit {
u16 addr;

View file

@ -59,8 +59,8 @@ static int af9033_wr_regs(struct af9033_state *state, u32 reg, const u8 *val,
if (ret == 1) {
ret = 0;
} else {
printk(KERN_WARNING "%s: i2c wr failed=%d reg=%06x len=%d\n",
__func__, ret, reg, len);
dev_warn(&state->i2c->dev, "%s: i2c wr failed=%d reg=%06x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
@ -91,8 +91,8 @@ static int af9033_rd_regs(struct af9033_state *state, u32 reg, u8 *val, int len)
if (ret == 2) {
ret = 0;
} else {
printk(KERN_WARNING "%s: i2c rd failed=%d reg=%06x len=%d\n",
__func__, ret, reg, len);
dev_warn(&state->i2c->dev, "%s: i2c rd failed=%d reg=%06x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
@ -156,11 +156,11 @@ static int af9033_rd_reg_mask(struct af9033_state *state, u32 reg, u8 *val,
return 0;
}
static u32 af9033_div(u32 a, u32 b, u32 x)
static u32 af9033_div(struct af9033_state *state, u32 a, u32 b, u32 x)
{
u32 r = 0, c = 0, i;
pr_debug("%s: a=%d b=%d x=%d\n", __func__, a, b, x);
dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d\n", __func__, a, b, x);
if (a > b) {
c = a / b;
@ -177,7 +177,8 @@ static u32 af9033_div(u32 a, u32 b, u32 x)
}
r = (c << (u32)x) + r;
pr_debug("%s: a=%d b=%d x=%d r=%d r=%x\n", __func__, a, b, x, r, r);
dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d r=%d r=%x\n",
__func__, a, b, x, r, r);
return r;
}
@ -225,14 +226,14 @@ static int af9033_init(struct dvb_frontend *fe)
};
/* program clock control */
clock_cw = af9033_div(state->cfg.clock, 1000000ul, 19ul);
clock_cw = af9033_div(state, state->cfg.clock, 1000000ul, 19ul);
buf[0] = (clock_cw >> 0) & 0xff;
buf[1] = (clock_cw >> 8) & 0xff;
buf[2] = (clock_cw >> 16) & 0xff;
buf[3] = (clock_cw >> 24) & 0xff;
pr_debug("%s: clock=%d clock_cw=%08x\n", __func__, state->cfg.clock,
clock_cw);
dev_dbg(&state->i2c->dev, "%s: clock=%d clock_cw=%08x\n",
__func__, state->cfg.clock, clock_cw);
ret = af9033_wr_regs(state, 0x800025, buf, 4);
if (ret < 0)
@ -244,13 +245,13 @@ static int af9033_init(struct dvb_frontend *fe)
break;
}
adc_cw = af9033_div(clock_adc_lut[i].adc, 1000000ul, 19ul);
adc_cw = af9033_div(state, clock_adc_lut[i].adc, 1000000ul, 19ul);
buf[0] = (adc_cw >> 0) & 0xff;
buf[1] = (adc_cw >> 8) & 0xff;
buf[2] = (adc_cw >> 16) & 0xff;
pr_debug("%s: adc=%d adc_cw=%06x\n", __func__, clock_adc_lut[i].adc,
adc_cw);
dev_dbg(&state->i2c->dev, "%s: adc=%d adc_cw=%06x\n",
__func__, clock_adc_lut[i].adc, adc_cw);
ret = af9033_wr_regs(state, 0x80f1cd, buf, 3);
if (ret < 0)
@ -284,7 +285,7 @@ static int af9033_init(struct dvb_frontend *fe)
}
/* load OFSM settings */
pr_debug("%s: load ofsm settings\n", __func__);
dev_dbg(&state->i2c->dev, "%s: load ofsm settings\n", __func__);
len = ARRAY_SIZE(ofsm_init);
init = ofsm_init;
for (i = 0; i < len; i++) {
@ -294,7 +295,7 @@ static int af9033_init(struct dvb_frontend *fe)
}
/* load tuner specific settings */
pr_debug("%s: load tuner specific settings\n",
dev_dbg(&state->i2c->dev, "%s: load tuner specific settings\n",
__func__);
switch (state->cfg.tuner) {
case AF9033_TUNER_TUA9001:
@ -313,9 +314,13 @@ static int af9033_init(struct dvb_frontend *fe)
len = ARRAY_SIZE(tuner_init_tda18218);
init = tuner_init_tda18218;
break;
case AF9033_TUNER_FC2580:
len = ARRAY_SIZE(tuner_init_fc2580);
init = tuner_init_fc2580;
break;
default:
pr_debug("%s: unsupported tuner ID=%d\n", __func__,
state->cfg.tuner);
dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
__func__, state->cfg.tuner);
ret = -ENODEV;
goto err;
}
@ -331,7 +336,7 @@ static int af9033_init(struct dvb_frontend *fe)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -358,7 +363,7 @@ static int af9033_sleep(struct dvb_frontend *fe)
usleep_range(200, 10000);
}
pr_debug("%s: loop=%d\n", __func__, i);
dev_dbg(&state->i2c->dev, "%s: loop=%d\n", __func__, i);
if (i == 0) {
ret = -ETIMEDOUT;
@ -384,7 +389,7 @@ static int af9033_sleep(struct dvb_frontend *fe)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -407,8 +412,8 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
u8 tmp, buf[3], bandwidth_reg_val;
u32 if_frequency, freq_cw, adc_freq;
pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency,
c->bandwidth_hz);
dev_dbg(&state->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n",
__func__, c->frequency, c->bandwidth_hz);
/* check bandwidth */
switch (c->bandwidth_hz) {
@ -422,7 +427,8 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
bandwidth_reg_val = 0x02;
break;
default:
pr_debug("%s: invalid bandwidth_hz\n", __func__);
dev_dbg(&state->i2c->dev, "%s: invalid bandwidth_hz\n",
__func__);
ret = -EINVAL;
goto err;
}
@ -467,7 +473,7 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
else
if_frequency *= -1;
freq_cw = af9033_div(if_frequency, adc_freq, 23ul);
freq_cw = af9033_div(state, if_frequency, adc_freq, 23ul);
if (spec_inv == -1)
freq_cw *= -1;
@ -522,7 +528,7 @@ static int af9033_set_frontend(struct dvb_frontend *fe)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -534,7 +540,7 @@ static int af9033_get_frontend(struct dvb_frontend *fe)
int ret;
u8 buf[8];
pr_debug("%s\n", __func__);
dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* read all needed registers */
ret = af9033_rd_regs(state, 0x80f900, buf, sizeof(buf));
@ -649,7 +655,7 @@ static int af9033_get_frontend(struct dvb_frontend *fe)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -695,7 +701,7 @@ static int af9033_read_status(struct dvb_frontend *fe, fe_status_t *status)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -749,7 +755,7 @@ static int af9033_read_snr(struct dvb_frontend *fe, u16 *snr)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -771,7 +777,7 @@ static int af9033_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -815,7 +821,8 @@ static int af9033_update_ch_stat(struct af9033_state *state)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -852,7 +859,7 @@ static int af9033_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
struct af9033_state *state = fe->demodulator_priv;
int ret;
pr_debug("%s: enable=%d\n", __func__, enable);
dev_dbg(&state->i2c->dev, "%s: enable=%d\n", __func__, enable);
ret = af9033_wr_reg_mask(state, 0x00fa04, enable, 0x01);
if (ret < 0)
@ -861,7 +868,7 @@ static int af9033_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
return 0;
err:
pr_debug("%s: failed=%d\n", __func__, ret);
dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -875,7 +882,7 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
struct af9033_state *state;
u8 buf[8];
pr_debug("%s:\n", __func__);
dev_dbg(&i2c->dev, "%s:\n", __func__);
/* allocate memory for the internal state */
state = kzalloc(sizeof(struct af9033_state), GFP_KERNEL);
@ -887,9 +894,9 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
memcpy(&state->cfg, config, sizeof(struct af9033_config));
if (state->cfg.clock != 12000000) {
printk(KERN_INFO "af9033: unsupported clock=%d, only " \
"12000000 Hz is supported currently\n",
state->cfg.clock);
dev_err(&state->i2c->dev, "%s: af9033: unsupported clock=%d, " \
"only 12000000 Hz is supported currently\n",
KBUILD_MODNAME, state->cfg.clock);
goto err;
}
@ -902,9 +909,18 @@ struct dvb_frontend *af9033_attach(const struct af9033_config *config,
if (ret < 0)
goto err;
printk(KERN_INFO "af9033: firmware version: LINK=%d.%d.%d.%d " \
"OFDM=%d.%d.%d.%d\n", buf[0], buf[1], buf[2], buf[3],
buf[4], buf[5], buf[6], buf[7]);
dev_info(&state->i2c->dev, "%s: firmware version: LINK=%d.%d.%d.%d " \
"OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
/* sleep */
ret = af9033_wr_reg(state, 0x80004c, 1);
if (ret < 0)
goto err;
ret = af9033_wr_reg(state, 0x800000, 0);
if (ret < 0)
goto err;
/* configure internal TS mode */
switch (state->cfg.ts_mode) {

View file

@ -42,6 +42,7 @@ struct af9033_config {
#define AF9033_TUNER_FC0011 0x28 /* Fitipower FC0011 */
#define AF9033_TUNER_MXL5007T 0xa0 /* MaxLinear MxL5007T */
#define AF9033_TUNER_TDA18218 0xa1 /* NXP TDA 18218HN */
#define AF9033_TUNER_FC2580 0x32 /* FCI FC2580 */
u8 tuner;
/*
@ -67,7 +68,7 @@ extern struct dvb_frontend *af9033_attach(const struct af9033_config *config,
static inline struct dvb_frontend *af9033_attach(
const struct af9033_config *config, struct i2c_adapter *i2c)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
pr_warn("%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif

View file

@ -466,5 +466,42 @@ static const struct reg_val tuner_init_tda18218[] = {
{0x80f1e6, 0x00},
};
/* FCI FC2580 tuner init */
static const struct reg_val tuner_init_fc2580[] = {
{ 0x800046, 0x32 },
{ 0x800057, 0x01 },
{ 0x800058, 0x00 },
{ 0x80005f, 0x00 },
{ 0x800060, 0x00 },
{ 0x800071, 0x05 },
{ 0x800072, 0x02 },
{ 0x800074, 0x01 },
{ 0x800079, 0x01 },
{ 0x800093, 0x00 },
{ 0x800094, 0x00 },
{ 0x800095, 0x00 },
{ 0x800096, 0x05 },
{ 0x8000b3, 0x01 },
{ 0x8000c3, 0x01 },
{ 0x8000c4, 0x00 },
{ 0x80f007, 0x00 },
{ 0x80f00c, 0x19 },
{ 0x80f00d, 0x1A },
{ 0x80f00e, 0x00 },
{ 0x80f00f, 0x02 },
{ 0x80f010, 0x00 },
{ 0x80f011, 0x02 },
{ 0x80f012, 0x00 },
{ 0x80f013, 0x02 },
{ 0x80f014, 0x00 },
{ 0x80f015, 0x02 },
{ 0x80f01f, 0x96 },
{ 0x80f020, 0x00 },
{ 0x80f029, 0x96 },
{ 0x80f02a, 0x00 },
{ 0x80f077, 0x01 },
{ 0x80f1e6, 0x01 },
};
#endif /* AF9033_PRIV_H */

View file

@ -428,7 +428,7 @@ static int atbm8830_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
}
static struct dvb_frontend_ops atbm8830_ops = {
.delsys = { SYS_DMBTH },
.delsys = { SYS_DTMB },
.info = {
.name = "AltoBeam ATBM8830/8831 DMB-TH",
.frequency_min = 474000000,

View file

@ -26,8 +26,6 @@
#include "dvb_frontend.h"
#include "au8522_priv.h"
MODULE_LICENSE("GPL");
static int debug;
#define dprintk(arg...)\
@ -101,6 +99,19 @@ int au8522_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
}
EXPORT_SYMBOL(au8522_i2c_gate_ctrl);
int au8522_analog_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct au8522_state *state = fe->demodulator_priv;
dprintk("%s(%d)\n", __func__, enable);
if (enable)
return au8522_writereg(state, 0x106, 1);
else
return au8522_writereg(state, 0x106, 0);
}
EXPORT_SYMBOL(au8522_analog_i2c_gate_ctrl);
/* Reset the demod hardware and reset all of the configuration registers
to a default state. */
int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
@ -257,3 +268,10 @@ int au8522_sleep(struct dvb_frontend *fe)
return 0;
}
EXPORT_SYMBOL(au8522_sleep);
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Enable verbose debug messages");
MODULE_DESCRIPTION("Auvitek AU8522 QAM-B/ATSC Demodulator driver");
MODULE_AUTHOR("Steven Toth");
MODULE_LICENSE("GPL");

View file

@ -257,9 +257,11 @@ static void setup_decoder_defaults(struct au8522_state *state, u8 input_mode)
au8522_writereg(state, AU8522_TVDED_DBG_MODE_REG060H,
AU8522_TVDED_DBG_MODE_REG060H_CVBS);
au8522_writereg(state, AU8522_TVDEC_FORMAT_CTRL1_REG061H,
AU8522_TVDEC_FORMAT_CTRL1_REG061H_CVBS13);
AU8522_TVDEC_FORMAT_CTRL1_REG061H_FIELD_LEN_525 |
AU8522_TVDEC_FORMAT_CTRL1_REG061H_LINE_LEN_63_492 |
AU8522_TVDEC_FORMAT_CTRL1_REG061H_SUBCARRIER_NTSC_MN);
au8522_writereg(state, AU8522_TVDEC_FORMAT_CTRL2_REG062H,
AU8522_TVDEC_FORMAT_CTRL2_REG062H_CVBS13);
AU8522_TVDEC_FORMAT_CTRL2_REG062H_STD_NTSC);
au8522_writereg(state, AU8522_TVDEC_VCR_DET_LLIM_REG063H,
AU8522_TVDEC_VCR_DET_LLIM_REG063H_CVBS);
au8522_writereg(state, AU8522_TVDEC_VCR_DET_HLIM_REG064H,
@ -657,11 +659,6 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd,
au8522_reset(sd, 0);
/* Jam open the i2c gate to the tuner. We do this here to handle the
case where the user went into digital mode (causing the gate to be
closed), and then came back to analog mode */
au8522_writereg(state, 0x106, 1);
if (input == AU8522_COMPOSITE_CH1) {
au8522_setup_cvbs_mode(state);
} else if (input == AU8522_SVIDEO_CH13) {

View file

@ -157,54 +157,54 @@ static struct mse2snr_tab qam64_mse2snr_tab[] = {
/* QAM256 SNR lookup table */
static struct mse2snr_tab qam256_mse2snr_tab[] = {
{ 16, 0 },
{ 17, 400 },
{ 18, 398 },
{ 19, 396 },
{ 20, 394 },
{ 21, 392 },
{ 22, 390 },
{ 23, 388 },
{ 24, 386 },
{ 25, 384 },
{ 26, 382 },
{ 27, 380 },
{ 28, 379 },
{ 29, 378 },
{ 30, 377 },
{ 31, 376 },
{ 32, 375 },
{ 33, 374 },
{ 34, 373 },
{ 35, 372 },
{ 36, 371 },
{ 37, 370 },
{ 38, 362 },
{ 39, 354 },
{ 40, 346 },
{ 41, 338 },
{ 42, 330 },
{ 43, 328 },
{ 44, 326 },
{ 45, 324 },
{ 46, 322 },
{ 47, 320 },
{ 48, 319 },
{ 49, 318 },
{ 50, 317 },
{ 51, 316 },
{ 52, 315 },
{ 53, 314 },
{ 54, 313 },
{ 55, 312 },
{ 56, 311 },
{ 57, 310 },
{ 58, 308 },
{ 59, 306 },
{ 60, 304 },
{ 61, 302 },
{ 62, 300 },
{ 63, 298 },
{ 15, 0 },
{ 16, 400 },
{ 17, 398 },
{ 18, 396 },
{ 19, 394 },
{ 20, 392 },
{ 21, 390 },
{ 22, 388 },
{ 23, 386 },
{ 24, 384 },
{ 25, 382 },
{ 26, 380 },
{ 27, 379 },
{ 28, 378 },
{ 29, 377 },
{ 30, 376 },
{ 31, 375 },
{ 32, 374 },
{ 33, 373 },
{ 34, 372 },
{ 35, 371 },
{ 36, 370 },
{ 37, 362 },
{ 38, 354 },
{ 39, 346 },
{ 40, 338 },
{ 41, 330 },
{ 42, 328 },
{ 43, 326 },
{ 44, 324 },
{ 45, 322 },
{ 46, 320 },
{ 47, 319 },
{ 48, 318 },
{ 49, 317 },
{ 50, 316 },
{ 51, 315 },
{ 52, 314 },
{ 53, 313 },
{ 54, 312 },
{ 55, 311 },
{ 56, 310 },
{ 57, 308 },
{ 58, 306 },
{ 59, 304 },
{ 60, 302 },
{ 61, 300 },
{ 62, 298 },
{ 65, 295 },
{ 68, 294 },
{ 70, 293 },
@ -777,6 +777,8 @@ struct dvb_frontend *au8522_attach(const struct au8522_config *config,
sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = state;
state->frontend.ops.analog_ops.i2c_gate_ctrl = au8522_analog_i2c_gate_ctrl;
if (au8522_init(&state->frontend) != 0) {
printk(KERN_ERR "%s: Failed to initialize correctly\n",
__func__);

View file

@ -82,6 +82,7 @@ int au8522_get_state(struct au8522_state **state, struct i2c_adapter *i2c,
u8 client_address);
void au8522_release_state(struct au8522_state *state);
int au8522_i2c_gate_ctrl(struct dvb_frontend *fe, int enable);
int au8522_analog_i2c_gate_ctrl(struct dvb_frontend *fe, int enable);
int au8522_led_ctrl(struct au8522_state *state, int led);
/* REGISTERS */
@ -325,6 +326,31 @@ int au8522_led_ctrl(struct au8522_state *state, int led);
/**************************************************************/
/* Format control 1 */
/* VCR Mode 7-6 */
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_VCR_MODE_YES 0x80
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_VCR_MODE_NO 0x40
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_VCR_MODE_AUTO 0x00
/* Field len 5-4 */
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_FIELD_LEN_625 0x20
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_FIELD_LEN_525 0x10
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_FIELD_LEN_AUTO 0x00
/* Line len (us) 3-2 */
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_LINE_LEN_64_000 0x0b
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_LINE_LEN_63_492 0x08
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_LINE_LEN_63_556 0x04
/* Subcarrier freq 1-0 */
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_SUBCARRIER_NTSC_AUTO 0x03
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_SUBCARRIER_NTSC_443 0x02
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_SUBCARRIER_NTSC_MN 0x01
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_SUBCARRIER_NTSC_50 0x00
/* Format control 2 */
#define AU8522_TVDEC_FORMAT_CTRL2_REG062H_STD_AUTODETECT 0x00
#define AU8522_TVDEC_FORMAT_CTRL2_REG062H_STD_NTSC 0x01
#define AU8522_INPUT_CONTROL_REG081H_ATSC 0xC4
#define AU8522_INPUT_CONTROL_REG081H_ATVRF 0xC4
#define AU8522_INPUT_CONTROL_REG081H_ATVRF13 0xC4
@ -385,9 +411,6 @@ int au8522_led_ctrl(struct au8522_state *state, int led);
#define AU8522_TVDEC_COMB_MODE_REG015H_CVBS 0x00
#define AU8522_REG016H_CVBS 0x00
#define AU8522_TVDED_DBG_MODE_REG060H_CVBS 0x00
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_CVBS 0x0B
#define AU8522_TVDEC_FORMAT_CTRL1_REG061H_CVBS13 0x03
#define AU8522_TVDEC_FORMAT_CTRL2_REG062H_CVBS13 0x00
#define AU8522_TVDEC_VCR_DET_LLIM_REG063H_CVBS 0x19
#define AU8522_REG0F9H_AUDIO 0x20
#define AU8522_TVDEC_VCR_DET_HLIM_REG064H_CVBS 0xA7

View file

@ -62,14 +62,6 @@ struct cxd2820r_config {
* Values: 0, 1
*/
bool spec_inv;
/* GPIOs for all used modes.
* Default: none, disabled
* Values: <see above>
*/
u8 gpio_dvbt[3];
u8 gpio_dvbt2[3];
u8 gpio_dvbc[3];
};
@ -77,12 +69,14 @@ struct cxd2820r_config {
(defined(CONFIG_DVB_CXD2820R_MODULE) && defined(MODULE))
extern struct dvb_frontend *cxd2820r_attach(
const struct cxd2820r_config *config,
struct i2c_adapter *i2c
struct i2c_adapter *i2c,
int *gpio_chip_base
);
#else
static inline struct dvb_frontend *cxd2820r_attach(
const struct cxd2820r_config *config,
struct i2c_adapter *i2c
struct i2c_adapter *i2c,
int *gpio_chip_base
)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);

View file

@ -47,12 +47,8 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
{ 0x10070, priv->cfg.ts_mode, 0xff },
};
dbg("%s: RF=%d SR=%d", __func__, c->frequency, c->symbol_rate);
/* update GPIOs */
ret = cxd2820r_gpio(fe);
if (ret)
goto error;
dev_dbg(&priv->i2c->dev, "%s: frequency=%d symbol_rate=%d\n", __func__,
c->frequency, c->symbol_rate);
/* program tuner */
if (fe->ops.tuner_ops.set_params)
@ -78,7 +74,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
} else
if_freq = 0;
dbg("%s: if_freq=%d", __func__, if_freq);
dev_dbg(&priv->i2c->dev, "%s: if_freq=%d\n", __func__, if_freq);
num = if_freq / 1000; /* Hz => kHz */
num *= 0x4000;
@ -100,7 +96,7 @@ int cxd2820r_set_frontend_c(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -150,7 +146,7 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -184,7 +180,7 @@ int cxd2820r_read_ber_c(struct dvb_frontend *fe, u32 *ber)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -214,7 +210,7 @@ int cxd2820r_read_signal_strength_c(struct dvb_frontend *fe,
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -251,7 +247,7 @@ int cxd2820r_read_snr_c(struct dvb_frontend *fe, u16 *snr)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -283,11 +279,12 @@ int cxd2820r_read_status_c(struct dvb_frontend *fe, fe_status_t *status)
}
}
dbg("%s: lock=%02x %02x", __func__, buf[0], buf[1]);
dev_dbg(&priv->i2c->dev, "%s: lock=%02x %02x\n", __func__, buf[0],
buf[1]);
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -302,7 +299,7 @@ int cxd2820r_init_c(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -318,7 +315,7 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe)
{ 0x00080, 0x00, 0xff },
};
dbg("%s", __func__);
dev_dbg(&priv->i2c->dev, "%s\n", __func__);
priv->delivery_system = SYS_UNDEFINED;
@ -331,7 +328,7 @@ int cxd2820r_sleep_c(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}

View file

@ -21,10 +21,6 @@
#include "cxd2820r_priv.h"
int cxd2820r_debug;
module_param_named(debug, cxd2820r_debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
/* write multiple registers */
static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg,
u8 *val, int len)
@ -47,7 +43,8 @@ static int cxd2820r_wr_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg,
if (ret == 1) {
ret = 0;
} else {
warn("i2c wr failed ret:%d reg:%02x len:%d", ret, reg, len);
dev_warn(&priv->i2c->dev, "%s: i2c wr failed=%d reg=%02x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
return ret;
@ -78,7 +75,8 @@ static int cxd2820r_rd_regs_i2c(struct cxd2820r_priv *priv, u8 i2c, u8 reg,
memcpy(val, buf, len);
ret = 0;
} else {
warn("i2c rd failed ret:%d reg:%02x len:%d", ret, reg, len);
dev_warn(&priv->i2c->dev, "%s: i2c rd failed=%d reg=%02x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
@ -170,27 +168,14 @@ int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
return cxd2820r_wr_reg(priv, reg, val);
}
int cxd2820r_gpio(struct dvb_frontend *fe)
int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret, i;
u8 *gpio, tmp0, tmp1;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
u8 tmp0, tmp1;
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
gpio = priv->cfg.gpio_dvbt;
break;
case SYS_DVBT2:
gpio = priv->cfg.gpio_dvbt2;
break;
case SYS_DVBC_ANNEX_AC:
gpio = priv->cfg.gpio_dvbc;
break;
default:
ret = -EINVAL;
goto error;
}
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
/* update GPIOs only when needed */
if (!memcmp(gpio, priv->gpio, sizeof(priv->gpio)))
@ -217,10 +202,12 @@ int cxd2820r_gpio(struct dvb_frontend *fe)
else
tmp1 |= (0 << (0 + i));
dbg("%s: GPIO i=%d %02x %02x", __func__, i, tmp0, tmp1);
dev_dbg(&priv->i2c->dev, "%s: gpio i=%d %02x %02x\n", __func__,
i, tmp0, tmp1);
}
dbg("%s: wr gpio=%02x %02x", __func__, tmp0, tmp1);
dev_dbg(&priv->i2c->dev, "%s: wr gpio=%02x %02x\n", __func__, tmp0,
tmp1);
/* write bits [7:2] */
ret = cxd2820r_wr_reg_mask(priv, 0x00089, tmp0, 0xfc);
@ -236,7 +223,7 @@ int cxd2820r_gpio(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -248,10 +235,13 @@ u32 cxd2820r_div_u64_round_closest(u64 dividend, u32 divisor)
static int cxd2820r_set_frontend(struct dvb_frontend *fe)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (c->delivery_system) {
case SYS_DVBT:
ret = cxd2820r_init_t(fe);
@ -278,7 +268,8 @@ static int cxd2820r_set_frontend(struct dvb_frontend *fe)
goto err;
break;
default:
dbg("%s: error state=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: error state=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
ret = -EINVAL;
break;
}
@ -287,9 +278,12 @@ err:
}
static int cxd2820r_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
ret = cxd2820r_read_status_t(fe, status);
@ -312,7 +306,8 @@ static int cxd2820r_get_frontend(struct dvb_frontend *fe)
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
if (priv->delivery_system == SYS_UNDEFINED)
return 0;
@ -336,9 +331,12 @@ static int cxd2820r_get_frontend(struct dvb_frontend *fe)
static int cxd2820r_read_ber(struct dvb_frontend *fe, u32 *ber)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
ret = cxd2820r_read_ber_t(fe, ber);
@ -358,9 +356,12 @@ static int cxd2820r_read_ber(struct dvb_frontend *fe, u32 *ber)
static int cxd2820r_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
ret = cxd2820r_read_signal_strength_t(fe, strength);
@ -380,9 +381,12 @@ static int cxd2820r_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
static int cxd2820r_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
ret = cxd2820r_read_snr_t(fe, snr);
@ -402,9 +406,12 @@ static int cxd2820r_read_snr(struct dvb_frontend *fe, u16 *snr)
static int cxd2820r_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
ret = cxd2820r_read_ucblocks_t(fe, ucblocks);
@ -429,9 +436,12 @@ static int cxd2820r_init(struct dvb_frontend *fe)
static int cxd2820r_sleep(struct dvb_frontend *fe)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
ret = cxd2820r_sleep_t(fe);
@ -452,9 +462,12 @@ static int cxd2820r_sleep(struct dvb_frontend *fe)
static int cxd2820r_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *s)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
int ret;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
switch (fe->dtv_property_cache.delivery_system) {
case SYS_DVBT:
ret = cxd2820r_get_tune_settings_t(fe, s);
@ -478,7 +491,9 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i;
fe_status_t status = 0;
dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system);
dev_dbg(&priv->i2c->dev, "%s: delsys=%d\n", __func__,
fe->dtv_property_cache.delivery_system);
/* switch between DVB-T and DVB-T2 when tune fails */
if (priv->last_tune_failed) {
@ -520,7 +535,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe)
/* wait frontend lock */
for (; i > 0; i--) {
dbg("%s: LOOP=%d", __func__, i);
dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i);
msleep(50);
ret = cxd2820r_read_status(fe, &status);
if (ret)
@ -540,7 +555,7 @@ static enum dvbfe_search cxd2820r_search(struct dvb_frontend *fe)
}
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return DVBFE_ALGO_SEARCH_ERROR;
}
@ -552,8 +567,19 @@ static int cxd2820r_get_frontend_algo(struct dvb_frontend *fe)
static void cxd2820r_release(struct dvb_frontend *fe)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
dbg("%s", __func__);
int uninitialized_var(ret); /* silence compiler warning */
dev_dbg(&priv->i2c->dev, "%s\n", __func__);
#ifdef CONFIG_GPIOLIB
/* remove GPIOs */
if (priv->gpio_chip.label) {
ret = gpiochip_remove(&priv->gpio_chip);
if (ret)
dev_err(&priv->i2c->dev, "%s: gpiochip_remove() " \
"failed=%d\n", KBUILD_MODNAME, ret);
}
#endif
kfree(priv);
return;
}
@ -561,12 +587,56 @@ static void cxd2820r_release(struct dvb_frontend *fe)
static int cxd2820r_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct cxd2820r_priv *priv = fe->demodulator_priv;
dbg("%s: %d", __func__, enable);
dev_dbg(&priv->i2c->dev, "%s: %d\n", __func__, enable);
/* Bit 0 of reg 0xdb in bank 0x00 controls I2C repeater */
return cxd2820r_wr_reg_mask(priv, 0xdb, enable ? 1 : 0, 0x1);
}
#ifdef CONFIG_GPIOLIB
static int cxd2820r_gpio_direction_output(struct gpio_chip *chip, unsigned nr,
int val)
{
struct cxd2820r_priv *priv =
container_of(chip, struct cxd2820r_priv, gpio_chip);
u8 gpio[GPIO_COUNT];
dev_dbg(&priv->i2c->dev, "%s: nr=%d val=%d\n", __func__, nr, val);
memcpy(gpio, priv->gpio, sizeof(gpio));
gpio[nr] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | (val << 2);
return cxd2820r_gpio(&priv->fe, gpio);
}
static void cxd2820r_gpio_set(struct gpio_chip *chip, unsigned nr, int val)
{
struct cxd2820r_priv *priv =
container_of(chip, struct cxd2820r_priv, gpio_chip);
u8 gpio[GPIO_COUNT];
dev_dbg(&priv->i2c->dev, "%s: nr=%d val=%d\n", __func__, nr, val);
memcpy(gpio, priv->gpio, sizeof(gpio));
gpio[nr] = CXD2820R_GPIO_E | CXD2820R_GPIO_O | (val << 2);
(void) cxd2820r_gpio(&priv->fe, gpio);
return;
}
static int cxd2820r_gpio_get(struct gpio_chip *chip, unsigned nr)
{
struct cxd2820r_priv *priv =
container_of(chip, struct cxd2820r_priv, gpio_chip);
dev_dbg(&priv->i2c->dev, "%s: nr=%d\n", __func__, nr);
return (priv->gpio[nr] >> 2) & 0x01;
}
#endif
static const struct dvb_frontend_ops cxd2820r_ops = {
.delsys = { SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_A },
/* default: DVB-T/T2 */
@ -613,29 +683,70 @@ static const struct dvb_frontend_ops cxd2820r_ops = {
};
struct dvb_frontend *cxd2820r_attach(const struct cxd2820r_config *cfg,
struct i2c_adapter *i2c)
struct i2c_adapter *i2c, int *gpio_chip_base
)
{
struct cxd2820r_priv *priv = NULL;
struct cxd2820r_priv *priv;
int ret;
u8 tmp;
u8 tmp, gpio[GPIO_COUNT];
priv = kzalloc(sizeof (struct cxd2820r_priv), GFP_KERNEL);
if (!priv)
priv = kzalloc(sizeof(struct cxd2820r_priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
dev_err(&i2c->dev, "%s: kzalloc() failed\n",
KBUILD_MODNAME);
goto error;
}
priv->i2c = i2c;
memcpy(&priv->cfg, cfg, sizeof (struct cxd2820r_config));
memcpy(&priv->cfg, cfg, sizeof(struct cxd2820r_config));
memcpy(&priv->fe.ops, &cxd2820r_ops, sizeof(struct dvb_frontend_ops));
priv->fe.demodulator_priv = priv;
priv->bank[0] = priv->bank[1] = 0xff;
ret = cxd2820r_rd_reg(priv, 0x000fd, &tmp);
dbg("%s: chip id=%02x", __func__, tmp);
dev_dbg(&priv->i2c->dev, "%s: chip id=%02x\n", __func__, tmp);
if (ret || tmp != 0xe1)
goto error;
memcpy(&priv->fe.ops, &cxd2820r_ops, sizeof (struct dvb_frontend_ops));
priv->fe.demodulator_priv = priv;
if (gpio_chip_base) {
#ifdef CONFIG_GPIOLIB
/* add GPIOs */
priv->gpio_chip.label = KBUILD_MODNAME;
priv->gpio_chip.dev = &priv->i2c->dev;
priv->gpio_chip.owner = THIS_MODULE;
priv->gpio_chip.direction_output =
cxd2820r_gpio_direction_output;
priv->gpio_chip.set = cxd2820r_gpio_set;
priv->gpio_chip.get = cxd2820r_gpio_get;
priv->gpio_chip.base = -1; /* dynamic allocation */
priv->gpio_chip.ngpio = GPIO_COUNT;
priv->gpio_chip.can_sleep = 1;
ret = gpiochip_add(&priv->gpio_chip);
if (ret)
goto error;
dev_dbg(&priv->i2c->dev, "%s: gpio_chip.base=%d\n", __func__,
priv->gpio_chip.base);
*gpio_chip_base = priv->gpio_chip.base;
#else
/*
* Use static GPIO configuration if GPIOLIB is undefined.
* This is fallback condition.
*/
gpio[0] = (*gpio_chip_base >> 0) & 0x07;
gpio[1] = (*gpio_chip_base >> 3) & 0x07;
gpio[2] = 0;
ret = cxd2820r_gpio(&priv->fe, gpio);
if (ret)
goto error;
#endif
}
return &priv->fe;
error:
dev_dbg(&i2c->dev, "%s: failed=%d\n", __func__, ret);
kfree(priv);
return NULL;
}

View file

@ -26,19 +26,7 @@
#include "dvb_frontend.h"
#include "dvb_math.h"
#include "cxd2820r.h"
#define LOG_PREFIX "cxd2820r"
#undef dbg
#define dbg(f, arg...) \
if (cxd2820r_debug) \
printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef err
#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
#undef info
#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef warn
#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
#include <linux/gpio.h>
struct reg_val_mask {
u32 reg;
@ -54,7 +42,11 @@ struct cxd2820r_priv {
bool ber_running;
u8 bank[2];
u8 gpio[3];
#define GPIO_COUNT 3
u8 gpio[GPIO_COUNT];
#ifdef CONFIG_GPIOLIB
struct gpio_chip gpio_chip;
#endif
fe_delivery_system_t delivery_system;
bool last_tune_failed; /* for switch between T and T2 tune */
@ -64,7 +56,7 @@ struct cxd2820r_priv {
extern int cxd2820r_debug;
int cxd2820r_gpio(struct dvb_frontend *fe);
int cxd2820r_gpio(struct dvb_frontend *fe, u8 *gpio);
int cxd2820r_wr_reg_mask(struct cxd2820r_priv *priv, u32 reg, u8 val,
u8 mask);

View file

@ -54,7 +54,8 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
{ 0x00427, 0x41, 0xff },
};
dbg("%s: RF=%d BW=%d", __func__, c->frequency, c->bandwidth_hz);
dev_dbg(&priv->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n", __func__,
c->frequency, c->bandwidth_hz);
switch (c->bandwidth_hz) {
case 6000000:
@ -73,11 +74,6 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
return -EINVAL;
}
/* update GPIOs */
ret = cxd2820r_gpio(fe);
if (ret)
goto error;
/* program tuner */
if (fe->ops.tuner_ops.set_params)
fe->ops.tuner_ops.set_params(fe);
@ -102,7 +98,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
} else
if_freq = 0;
dbg("%s: if_freq=%d", __func__, if_freq);
dev_dbg(&priv->i2c->dev, "%s: if_freq=%d\n", __func__, if_freq);
num = if_freq / 1000; /* Hz => kHz */
num *= 0x1000000;
@ -137,7 +133,7 @@ int cxd2820r_set_frontend_t(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -254,7 +250,7 @@ int cxd2820r_get_frontend_t(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -288,7 +284,7 @@ int cxd2820r_read_ber_t(struct dvb_frontend *fe, u32 *ber)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -312,7 +308,7 @@ int cxd2820r_read_signal_strength_t(struct dvb_frontend *fe,
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -336,11 +332,12 @@ int cxd2820r_read_snr_t(struct dvb_frontend *fe, u16 *snr)
else
*snr = 0;
dbg("%s: dBx10=%d val=%04x", __func__, *snr, tmp);
dev_dbg(&priv->i2c->dev, "%s: dBx10=%d val=%04x\n", __func__, *snr,
tmp);
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -389,12 +386,11 @@ int cxd2820r_read_status_t(struct dvb_frontend *fe, fe_status_t *status)
}
}
dbg("%s: lock=%02x %02x %02x %02x", __func__,
buf[0], buf[1], buf[2], buf[3]);
dev_dbg(&priv->i2c->dev, "%s: lock=%*ph\n", __func__, 4, buf);
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -409,7 +405,7 @@ int cxd2820r_init_t(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
@ -425,7 +421,7 @@ int cxd2820r_sleep_t(struct dvb_frontend *fe)
{ 0x00080, 0x00, 0xff },
};
dbg("%s", __func__);
dev_dbg(&priv->i2c->dev, "%s\n", __func__);
priv->delivery_system = SYS_UNDEFINED;
@ -438,7 +434,7 @@ int cxd2820r_sleep_t(struct dvb_frontend *fe)
return ret;
error:
dbg("%s: failed:%d", __func__, ret);
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}

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