提交 93094449 编写于 作者: L Linus Torvalds

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

Pull media fixes from Mauro Carvalho Chehab:
 "A series of bug fix patches for v3.15-rc1.  Most are just driver
  fixes.  There are some changes at remote controller core level, fixing
  some definitions on a new API added for Kernel v3.15.

  It also adds the missing include at include/uapi/linux/v4l2-common.h,
  to allow its compilation on userspace, as pointed by you"

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (24 commits)
  [media] gpsca: remove the risk of a division by zero
  [media] stk1160: warrant a NUL terminated string
  [media] v4l: ti-vpe: retain v4l2_buffer flags for captured buffers
  [media] v4l: ti-vpe: Set correct field parameter for output and capture buffers
  [media] v4l: ti-vpe: zero out reserved fields in try_fmt
  [media] v4l: ti-vpe: Fix initial configuration queue data
  [media] v4l: ti-vpe: Use correct bus_info name for the device in querycap
  [media] v4l: ti-vpe: report correct capabilities in querycap
  [media] v4l: ti-vpe: Allow usage of smaller images
  [media] v4l: ti-vpe: Use video_device_release_empty
  [media] v4l: ti-vpe: Make sure in job_ready that we have the needed number of dst_bufs
  [media] lgdt3305: include sleep functionality in lgdt3304_ops
  [media] drx-j: use customise option correctly
  [media] m88rs2000: fix sparse static warnings
  [media] r820t: fix size and init values
  [media] rc-core: remove generic scancode filter
  [media] rc-core: split dev->s_filter
  [media] rc-core: do not change 32bit NEC scancode format for now
  [media] rtl28xxu: remove duplicate ID 0458:707f Genius TVGo DVB-T03
  [media] xc2028: add missing break to switch
  ...
config DVB_DRX39XYJ config DVB_DRX39XYJ
tristate "Micronas DRX-J demodulator" tristate "Micronas DRX-J demodulator"
depends on DVB_CORE && I2C depends on DVB_CORE && I2C
default m if DVB_FE_CUSTOMISE default m if !MEDIA_SUBDRV_AUTOSELECT
help help
An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
to support this frontend. to support this frontend.
...@@ -1176,6 +1176,7 @@ static struct dvb_frontend_ops lgdt3304_ops = { ...@@ -1176,6 +1176,7 @@ static struct dvb_frontend_ops lgdt3304_ops = {
}, },
.i2c_gate_ctrl = lgdt3305_i2c_gate_ctrl, .i2c_gate_ctrl = lgdt3305_i2c_gate_ctrl,
.init = lgdt3305_init, .init = lgdt3305_init,
.sleep = lgdt3305_sleep,
.set_frontend = lgdt3304_set_parameters, .set_frontend = lgdt3304_set_parameters,
.get_frontend = lgdt3305_get_frontend, .get_frontend = lgdt3305_get_frontend,
.get_tune_settings = lgdt3305_get_tune_settings, .get_tune_settings = lgdt3305_get_tune_settings,
......
...@@ -297,7 +297,7 @@ struct inittab { ...@@ -297,7 +297,7 @@ struct inittab {
u8 val; u8 val;
}; };
struct inittab m88rs2000_setup[] = { static struct inittab m88rs2000_setup[] = {
{DEMOD_WRITE, 0x9a, 0x30}, {DEMOD_WRITE, 0x9a, 0x30},
{DEMOD_WRITE, 0x00, 0x01}, {DEMOD_WRITE, 0x00, 0x01},
{WRITE_DELAY, 0x19, 0x00}, {WRITE_DELAY, 0x19, 0x00},
...@@ -315,7 +315,7 @@ struct inittab m88rs2000_setup[] = { ...@@ -315,7 +315,7 @@ struct inittab m88rs2000_setup[] = {
{0xff, 0xaa, 0xff} {0xff, 0xaa, 0xff}
}; };
struct inittab m88rs2000_shutdown[] = { static struct inittab m88rs2000_shutdown[] = {
{DEMOD_WRITE, 0x9a, 0x30}, {DEMOD_WRITE, 0x9a, 0x30},
{DEMOD_WRITE, 0xb0, 0x00}, {DEMOD_WRITE, 0xb0, 0x00},
{DEMOD_WRITE, 0xf1, 0x89}, {DEMOD_WRITE, 0xf1, 0x89},
...@@ -325,7 +325,7 @@ struct inittab m88rs2000_shutdown[] = { ...@@ -325,7 +325,7 @@ struct inittab m88rs2000_shutdown[] = {
{0xff, 0xaa, 0xff} {0xff, 0xaa, 0xff}
}; };
struct inittab fe_reset[] = { static struct inittab fe_reset[] = {
{DEMOD_WRITE, 0x00, 0x01}, {DEMOD_WRITE, 0x00, 0x01},
{DEMOD_WRITE, 0x20, 0x81}, {DEMOD_WRITE, 0x20, 0x81},
{DEMOD_WRITE, 0x21, 0x80}, {DEMOD_WRITE, 0x21, 0x80},
...@@ -363,7 +363,7 @@ struct inittab fe_reset[] = { ...@@ -363,7 +363,7 @@ struct inittab fe_reset[] = {
{0xff, 0xaa, 0xff} {0xff, 0xaa, 0xff}
}; };
struct inittab fe_trigger[] = { static struct inittab fe_trigger[] = {
{DEMOD_WRITE, 0x97, 0x04}, {DEMOD_WRITE, 0x97, 0x04},
{DEMOD_WRITE, 0x99, 0x77}, {DEMOD_WRITE, 0x99, 0x77},
{DEMOD_WRITE, 0x9b, 0x64}, {DEMOD_WRITE, 0x9b, 0x64},
......
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
#define VPE_MODULE_NAME "vpe" #define VPE_MODULE_NAME "vpe"
/* minimum and maximum frame sizes */ /* minimum and maximum frame sizes */
#define MIN_W 128 #define MIN_W 32
#define MIN_H 128 #define MIN_H 32
#define MAX_W 1920 #define MAX_W 1920
#define MAX_H 1080 #define MAX_H 1080
...@@ -887,6 +887,9 @@ static int job_ready(void *priv) ...@@ -887,6 +887,9 @@ static int job_ready(void *priv)
if (v4l2_m2m_num_src_bufs_ready(ctx->m2m_ctx) < needed) if (v4l2_m2m_num_src_bufs_ready(ctx->m2m_ctx) < needed)
return 0; return 0;
if (v4l2_m2m_num_dst_bufs_ready(ctx->m2m_ctx) < needed)
return 0;
return 1; return 1;
} }
...@@ -1277,18 +1280,17 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) ...@@ -1277,18 +1280,17 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data)
s_buf = &s_vb->v4l2_buf; s_buf = &s_vb->v4l2_buf;
d_buf = &d_vb->v4l2_buf; d_buf = &d_vb->v4l2_buf;
d_buf->flags = s_buf->flags;
d_buf->timestamp = s_buf->timestamp; d_buf->timestamp = s_buf->timestamp;
d_buf->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK; if (s_buf->flags & V4L2_BUF_FLAG_TIMECODE)
d_buf->flags |= s_buf->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
if (s_buf->flags & V4L2_BUF_FLAG_TIMECODE) {
d_buf->flags |= V4L2_BUF_FLAG_TIMECODE;
d_buf->timecode = s_buf->timecode; d_buf->timecode = s_buf->timecode;
}
d_buf->sequence = ctx->sequence; d_buf->sequence = ctx->sequence;
d_buf->field = ctx->field;
d_q_data = &ctx->q_data[Q_DATA_DST]; d_q_data = &ctx->q_data[Q_DATA_DST];
if (d_q_data->flags & Q_DATA_INTERLACED) { if (d_q_data->flags & Q_DATA_INTERLACED) {
d_buf->field = ctx->field;
if (ctx->field == V4L2_FIELD_BOTTOM) { if (ctx->field == V4L2_FIELD_BOTTOM) {
ctx->sequence++; ctx->sequence++;
ctx->field = V4L2_FIELD_TOP; ctx->field = V4L2_FIELD_TOP;
...@@ -1297,6 +1299,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) ...@@ -1297,6 +1299,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data)
ctx->field = V4L2_FIELD_BOTTOM; ctx->field = V4L2_FIELD_BOTTOM;
} }
} else { } else {
d_buf->field = V4L2_FIELD_NONE;
ctx->sequence++; ctx->sequence++;
} }
...@@ -1335,8 +1338,9 @@ static int vpe_querycap(struct file *file, void *priv, ...@@ -1335,8 +1338,9 @@ static int vpe_querycap(struct file *file, void *priv,
{ {
strncpy(cap->driver, VPE_MODULE_NAME, sizeof(cap->driver) - 1); strncpy(cap->driver, VPE_MODULE_NAME, sizeof(cap->driver) - 1);
strncpy(cap->card, VPE_MODULE_NAME, sizeof(cap->card) - 1); strncpy(cap->card, VPE_MODULE_NAME, sizeof(cap->card) - 1);
strlcpy(cap->bus_info, VPE_MODULE_NAME, sizeof(cap->bus_info)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
cap->device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING; VPE_MODULE_NAME);
cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -1476,6 +1480,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, ...@@ -1476,6 +1480,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f,
} }
} }
memset(pix->reserved, 0, sizeof(pix->reserved));
for (i = 0; i < pix->num_planes; i++) { for (i = 0; i < pix->num_planes; i++) {
plane_fmt = &pix->plane_fmt[i]; plane_fmt = &pix->plane_fmt[i];
depth = fmt->vpdma_fmt[i]->depth; depth = fmt->vpdma_fmt[i]->depth;
...@@ -1487,6 +1492,8 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, ...@@ -1487,6 +1492,8 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f,
plane_fmt->sizeimage = plane_fmt->sizeimage =
(pix->height * pix->width * depth) >> 3; (pix->height * pix->width * depth) >> 3;
memset(plane_fmt->reserved, 0, sizeof(plane_fmt->reserved));
} }
return 0; return 0;
...@@ -1717,6 +1724,16 @@ static int vpe_buf_prepare(struct vb2_buffer *vb) ...@@ -1717,6 +1724,16 @@ static int vpe_buf_prepare(struct vb2_buffer *vb)
q_data = get_q_data(ctx, vb->vb2_queue->type); q_data = get_q_data(ctx, vb->vb2_queue->type);
num_planes = q_data->fmt->coplanar ? 2 : 1; num_planes = q_data->fmt->coplanar ? 2 : 1;
if (vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
if (!(q_data->flags & Q_DATA_INTERLACED)) {
vb->v4l2_buf.field = V4L2_FIELD_NONE;
} else {
if (vb->v4l2_buf.field != V4L2_FIELD_TOP &&
vb->v4l2_buf.field != V4L2_FIELD_BOTTOM)
return -EINVAL;
}
}
for (i = 0; i < num_planes; i++) { for (i = 0; i < num_planes; i++) {
if (vb2_plane_size(vb, i) < q_data->sizeimage[i]) { if (vb2_plane_size(vb, i) < q_data->sizeimage[i]) {
vpe_err(ctx->dev, vpe_err(ctx->dev,
...@@ -1866,9 +1883,11 @@ static int vpe_open(struct file *file) ...@@ -1866,9 +1883,11 @@ static int vpe_open(struct file *file)
s_q_data->fmt = &vpe_formats[2]; s_q_data->fmt = &vpe_formats[2];
s_q_data->width = 1920; s_q_data->width = 1920;
s_q_data->height = 1080; s_q_data->height = 1080;
s_q_data->sizeimage[VPE_LUMA] = (s_q_data->width * s_q_data->height * s_q_data->bytesperline[VPE_LUMA] = (s_q_data->width *
s_q_data->fmt->vpdma_fmt[VPE_LUMA]->depth) >> 3; s_q_data->fmt->vpdma_fmt[VPE_LUMA]->depth) >> 3;
s_q_data->colorspace = V4L2_COLORSPACE_SMPTE170M; s_q_data->sizeimage[VPE_LUMA] = (s_q_data->bytesperline[VPE_LUMA] *
s_q_data->height);
s_q_data->colorspace = V4L2_COLORSPACE_REC709;
s_q_data->field = V4L2_FIELD_NONE; s_q_data->field = V4L2_FIELD_NONE;
s_q_data->c_rect.left = 0; s_q_data->c_rect.left = 0;
s_q_data->c_rect.top = 0; s_q_data->c_rect.top = 0;
...@@ -2002,7 +2021,7 @@ static struct video_device vpe_videodev = { ...@@ -2002,7 +2021,7 @@ static struct video_device vpe_videodev = {
.fops = &vpe_fops, .fops = &vpe_fops,
.ioctl_ops = &vpe_ioctl_ops, .ioctl_ops = &vpe_ioctl_ops,
.minor = -1, .minor = -1,
.release = video_device_release, .release = video_device_release_empty,
.vfl_dir = VFL_DIR_M2M, .vfl_dir = VFL_DIR_M2M,
}; };
......
...@@ -504,6 +504,18 @@ static int img_ir_set_filter(struct rc_dev *dev, enum rc_filter_type type, ...@@ -504,6 +504,18 @@ static int img_ir_set_filter(struct rc_dev *dev, enum rc_filter_type type,
return ret; return ret;
} }
static int img_ir_set_normal_filter(struct rc_dev *dev,
struct rc_scancode_filter *sc_filter)
{
return img_ir_set_filter(dev, RC_FILTER_NORMAL, sc_filter);
}
static int img_ir_set_wakeup_filter(struct rc_dev *dev,
struct rc_scancode_filter *sc_filter)
{
return img_ir_set_filter(dev, RC_FILTER_WAKEUP, sc_filter);
}
/** /**
* img_ir_set_decoder() - Set the current decoder. * img_ir_set_decoder() - Set the current decoder.
* @priv: IR private data. * @priv: IR private data.
...@@ -986,7 +998,8 @@ int img_ir_probe_hw(struct img_ir_priv *priv) ...@@ -986,7 +998,8 @@ int img_ir_probe_hw(struct img_ir_priv *priv)
rdev->map_name = RC_MAP_EMPTY; rdev->map_name = RC_MAP_EMPTY;
rc_set_allowed_protocols(rdev, img_ir_allowed_protos(priv)); rc_set_allowed_protocols(rdev, img_ir_allowed_protos(priv));
rdev->input_name = "IMG Infrared Decoder"; rdev->input_name = "IMG Infrared Decoder";
rdev->s_filter = img_ir_set_filter; rdev->s_filter = img_ir_set_normal_filter;
rdev->s_wakeup_filter = img_ir_set_wakeup_filter;
/* Register hardware decoder */ /* Register hardware decoder */
error = rc_register_device(rdev); error = rc_register_device(rdev);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include "img-ir-hw.h" #include "img-ir-hw.h"
#include <linux/bitrev.h>
/* Convert NEC data to a scancode */ /* Convert NEC data to a scancode */
static int img_ir_nec_scancode(int len, u64 raw, int *scancode, u64 protocols) static int img_ir_nec_scancode(int len, u64 raw, int *scancode, u64 protocols)
...@@ -22,11 +23,11 @@ static int img_ir_nec_scancode(int len, u64 raw, int *scancode, u64 protocols) ...@@ -22,11 +23,11 @@ static int img_ir_nec_scancode(int len, u64 raw, int *scancode, u64 protocols)
data_inv = (raw >> 24) & 0xff; data_inv = (raw >> 24) & 0xff;
if ((data_inv ^ data) != 0xff) { if ((data_inv ^ data) != 0xff) {
/* 32-bit NEC (used by Apple and TiVo remotes) */ /* 32-bit NEC (used by Apple and TiVo remotes) */
/* scan encoding: aaAAddDD */ /* scan encoding: as transmitted, MSBit = first received bit */
*scancode = addr_inv << 24 | *scancode = bitrev8(addr) << 24 |
addr << 16 | bitrev8(addr_inv) << 16 |
data_inv << 8 | bitrev8(data) << 8 |
data; bitrev8(data_inv);
} else if ((addr_inv ^ addr) != 0xff) { } else if ((addr_inv ^ addr) != 0xff) {
/* Extended NEC */ /* Extended NEC */
/* scan encoding: AAaaDD */ /* scan encoding: AAaaDD */
...@@ -54,13 +55,15 @@ static int img_ir_nec_filter(const struct rc_scancode_filter *in, ...@@ -54,13 +55,15 @@ static int img_ir_nec_filter(const struct rc_scancode_filter *in,
if ((in->data | in->mask) & 0xff000000) { if ((in->data | in->mask) & 0xff000000) {
/* 32-bit NEC (used by Apple and TiVo remotes) */ /* 32-bit NEC (used by Apple and TiVo remotes) */
/* scan encoding: aaAAddDD */ /* scan encoding: as transmitted, MSBit = first received bit */
addr_inv = (in->data >> 24) & 0xff; addr = bitrev8(in->data >> 24);
addr_inv_m = (in->mask >> 24) & 0xff; addr_m = bitrev8(in->mask >> 24);
addr = (in->data >> 16) & 0xff; addr_inv = bitrev8(in->data >> 16);
addr_m = (in->mask >> 16) & 0xff; addr_inv_m = bitrev8(in->mask >> 16);
data_inv = (in->data >> 8) & 0xff; data = bitrev8(in->data >> 8);
data_inv_m = (in->mask >> 8) & 0xff; data_m = bitrev8(in->mask >> 8);
data_inv = bitrev8(in->data >> 0);
data_inv_m = bitrev8(in->mask >> 0);
} else if ((in->data | in->mask) & 0x00ff0000) { } else if ((in->data | in->mask) & 0x00ff0000) {
/* Extended NEC */ /* Extended NEC */
/* scan encoding AAaaDD */ /* scan encoding AAaaDD */
......
...@@ -172,10 +172,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) ...@@ -172,10 +172,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
if (send_32bits) { if (send_32bits) {
/* NEC transport, but modified protocol, used by at /* NEC transport, but modified protocol, used by at
* least Apple and TiVo remotes */ * least Apple and TiVo remotes */
scancode = not_address << 24 | scancode = data->bits;
address << 16 |
not_command << 8 |
command;
IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode); IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode);
} else if ((address ^ not_address) != 0xff) { } else if ((address ^ not_address) != 0xff) {
/* Extended NEC */ /* Extended NEC */
......
...@@ -15,62 +15,62 @@ ...@@ -15,62 +15,62 @@
* Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle, * Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle,
* which also ships with a TiVo-branded IR transceiver, supported by the mceusb * which also ships with a TiVo-branded IR transceiver, supported by the mceusb
* driver. Note that the remote uses an NEC-ish protocol, but instead of having * driver. Note that the remote uses an NEC-ish protocol, but instead of having
* a command/not_command pair, it has a vendor ID of 0x3085, but some keys, the * a command/not_command pair, it has a vendor ID of 0xa10c, but some keys, the
* NEC extended checksums do pass, so the table presently has the intended * NEC extended checksums do pass, so the table presently has the intended
* values and the checksum-passed versions for those keys. * values and the checksum-passed versions for those keys.
*/ */
static struct rc_map_table tivo[] = { static struct rc_map_table tivo[] = {
{ 0x3085f009, KEY_MEDIA }, /* TiVo Button */ { 0xa10c900f, KEY_MEDIA }, /* TiVo Button */
{ 0x3085e010, KEY_POWER2 }, /* TV Power */ { 0xa10c0807, KEY_POWER2 }, /* TV Power */
{ 0x3085e011, KEY_TV }, /* Live TV/Swap */ { 0xa10c8807, KEY_TV }, /* Live TV/Swap */
{ 0x3085c034, KEY_VIDEO_NEXT }, /* TV Input */ { 0xa10c2c03, KEY_VIDEO_NEXT }, /* TV Input */
{ 0x3085e013, KEY_INFO }, { 0xa10cc807, KEY_INFO },
{ 0x3085a05f, KEY_CYCLEWINDOWS }, /* Window */ { 0xa10cfa05, KEY_CYCLEWINDOWS }, /* Window */
{ 0x0085305f, KEY_CYCLEWINDOWS }, { 0x0085305f, KEY_CYCLEWINDOWS },
{ 0x3085c036, KEY_EPG }, /* Guide */ { 0xa10c6c03, KEY_EPG }, /* Guide */
{ 0x3085e014, KEY_UP }, { 0xa10c2807, KEY_UP },
{ 0x3085e016, KEY_DOWN }, { 0xa10c6807, KEY_DOWN },
{ 0x3085e017, KEY_LEFT }, { 0xa10ce807, KEY_LEFT },
{ 0x3085e015, KEY_RIGHT }, { 0xa10ca807, KEY_RIGHT },
{ 0x3085e018, KEY_SCROLLDOWN }, /* Red Thumbs Down */ { 0xa10c1807, KEY_SCROLLDOWN }, /* Red Thumbs Down */
{ 0x3085e019, KEY_SELECT }, { 0xa10c9807, KEY_SELECT },
{ 0x3085e01a, KEY_SCROLLUP }, /* Green Thumbs Up */ { 0xa10c5807, KEY_SCROLLUP }, /* Green Thumbs Up */
{ 0x3085e01c, KEY_VOLUMEUP }, { 0xa10c3807, KEY_VOLUMEUP },
{ 0x3085e01d, KEY_VOLUMEDOWN }, { 0xa10cb807, KEY_VOLUMEDOWN },
{ 0x3085e01b, KEY_MUTE }, { 0xa10cd807, KEY_MUTE },
{ 0x3085d020, KEY_RECORD }, { 0xa10c040b, KEY_RECORD },
{ 0x3085e01e, KEY_CHANNELUP }, { 0xa10c7807, KEY_CHANNELUP },
{ 0x3085e01f, KEY_CHANNELDOWN }, { 0xa10cf807, KEY_CHANNELDOWN },
{ 0x0085301f, KEY_CHANNELDOWN }, { 0x0085301f, KEY_CHANNELDOWN },
{ 0x3085d021, KEY_PLAY }, { 0xa10c840b, KEY_PLAY },
{ 0x3085d023, KEY_PAUSE }, { 0xa10cc40b, KEY_PAUSE },
{ 0x3085d025, KEY_SLOW }, { 0xa10ca40b, KEY_SLOW },
{ 0x3085d022, KEY_REWIND }, { 0xa10c440b, KEY_REWIND },
{ 0x3085d024, KEY_FASTFORWARD }, { 0xa10c240b, KEY_FASTFORWARD },
{ 0x3085d026, KEY_PREVIOUS }, { 0xa10c640b, KEY_PREVIOUS },
{ 0x3085d027, KEY_NEXT }, /* ->| */ { 0xa10ce40b, KEY_NEXT }, /* ->| */
{ 0x3085b044, KEY_ZOOM }, /* Aspect */ { 0xa10c220d, KEY_ZOOM }, /* Aspect */
{ 0x3085b048, KEY_STOP }, { 0xa10c120d, KEY_STOP },
{ 0x3085b04a, KEY_DVD }, /* DVD Menu */ { 0xa10c520d, KEY_DVD }, /* DVD Menu */
{ 0x3085d028, KEY_NUMERIC_1 }, { 0xa10c140b, KEY_NUMERIC_1 },
{ 0x3085d029, KEY_NUMERIC_2 }, { 0xa10c940b, KEY_NUMERIC_2 },
{ 0x3085d02a, KEY_NUMERIC_3 }, { 0xa10c540b, KEY_NUMERIC_3 },
{ 0x3085d02b, KEY_NUMERIC_4 }, { 0xa10cd40b, KEY_NUMERIC_4 },
{ 0x3085d02c, KEY_NUMERIC_5 }, { 0xa10c340b, KEY_NUMERIC_5 },
{ 0x3085d02d, KEY_NUMERIC_6 }, { 0xa10cb40b, KEY_NUMERIC_6 },
{ 0x3085d02e, KEY_NUMERIC_7 }, { 0xa10c740b, KEY_NUMERIC_7 },
{ 0x3085d02f, KEY_NUMERIC_8 }, { 0xa10cf40b, KEY_NUMERIC_8 },
{ 0x0085302f, KEY_NUMERIC_8 }, { 0x0085302f, KEY_NUMERIC_8 },
{ 0x3085c030, KEY_NUMERIC_9 }, { 0xa10c0c03, KEY_NUMERIC_9 },
{ 0x3085c031, KEY_NUMERIC_0 }, { 0xa10c8c03, KEY_NUMERIC_0 },
{ 0x3085c033, KEY_ENTER }, { 0xa10ccc03, KEY_ENTER },
{ 0x3085c032, KEY_CLEAR }, { 0xa10c4c03, KEY_CLEAR },
}; };
static struct rc_map_list tivo_map = { static struct rc_map_list tivo_map = {
......
...@@ -633,19 +633,13 @@ EXPORT_SYMBOL_GPL(rc_repeat); ...@@ -633,19 +633,13 @@ EXPORT_SYMBOL_GPL(rc_repeat);
static void ir_do_keydown(struct rc_dev *dev, int scancode, static void ir_do_keydown(struct rc_dev *dev, int scancode,
u32 keycode, u8 toggle) u32 keycode, u8 toggle)
{ {
struct rc_scancode_filter *filter; bool new_event = (!dev->keypressed ||
bool new_event = !dev->keypressed || dev->last_scancode != scancode ||
dev->last_scancode != scancode || dev->last_toggle != toggle);
dev->last_toggle != toggle;
if (new_event && dev->keypressed) if (new_event && dev->keypressed)
ir_do_keyup(dev, false); ir_do_keyup(dev, false);
/* Generic scancode filtering */
filter = &dev->scancode_filters[RC_FILTER_NORMAL];
if (filter->mask && ((scancode ^ filter->data) & filter->mask))
return;
input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode); input_event(dev->input_dev, EV_MSC, MSC_SCAN, scancode);
if (new_event && keycode != KEY_RESERVED) { if (new_event && keycode != KEY_RESERVED) {
...@@ -923,6 +917,7 @@ static ssize_t store_protocols(struct device *device, ...@@ -923,6 +917,7 @@ static ssize_t store_protocols(struct device *device,
int rc, i, count = 0; int rc, i, count = 0;
ssize_t ret; ssize_t ret;
int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
int (*set_filter)(struct rc_dev *dev, struct rc_scancode_filter *filter);
struct rc_scancode_filter local_filter, *filter; struct rc_scancode_filter local_filter, *filter;
/* Device is being removed */ /* Device is being removed */
...@@ -1007,24 +1002,23 @@ static ssize_t store_protocols(struct device *device, ...@@ -1007,24 +1002,23 @@ static ssize_t store_protocols(struct device *device,
* Fall back to clearing the filter. * Fall back to clearing the filter.
*/ */
filter = &dev->scancode_filters[fattr->type]; filter = &dev->scancode_filters[fattr->type];
if (old_type != type && filter->mask) { set_filter = (fattr->type == RC_FILTER_NORMAL)
? dev->s_filter : dev->s_wakeup_filter;
if (set_filter && old_type != type && filter->mask) {
local_filter = *filter; local_filter = *filter;
if (!type) { if (!type) {
/* no protocol => clear filter */ /* no protocol => clear filter */
ret = -1; ret = -1;
} else if (!dev->s_filter) {
/* generic filtering => accept any filter */
ret = 0;
} else { } else {
/* hardware filtering => try setting, otherwise clear */ /* hardware filtering => try setting, otherwise clear */
ret = dev->s_filter(dev, fattr->type, &local_filter); ret = set_filter(dev, &local_filter);
} }
if (ret < 0) { if (ret < 0) {
/* clear the filter */ /* clear the filter */
local_filter.data = 0; local_filter.data = 0;
local_filter.mask = 0; local_filter.mask = 0;
if (dev->s_filter) set_filter(dev, &local_filter);
dev->s_filter(dev, fattr->type, &local_filter);
} }
/* commit the new filter */ /* commit the new filter */
...@@ -1068,7 +1062,10 @@ static ssize_t show_filter(struct device *device, ...@@ -1068,7 +1062,10 @@ static ssize_t show_filter(struct device *device,
return -EINVAL; return -EINVAL;
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
if (fattr->mask) if ((fattr->type == RC_FILTER_NORMAL && !dev->s_filter) ||
(fattr->type == RC_FILTER_WAKEUP && !dev->s_wakeup_filter))
val = 0;
else if (fattr->mask)
val = dev->scancode_filters[fattr->type].mask; val = dev->scancode_filters[fattr->type].mask;
else else
val = dev->scancode_filters[fattr->type].data; val = dev->scancode_filters[fattr->type].data;
...@@ -1106,6 +1103,7 @@ static ssize_t store_filter(struct device *device, ...@@ -1106,6 +1103,7 @@ static ssize_t store_filter(struct device *device,
struct rc_scancode_filter local_filter, *filter; struct rc_scancode_filter local_filter, *filter;
int ret; int ret;
unsigned long val; unsigned long val;
int (*set_filter)(struct rc_dev *dev, struct rc_scancode_filter *filter);
/* Device is being removed */ /* Device is being removed */
if (!dev) if (!dev)
...@@ -1115,9 +1113,11 @@ static ssize_t store_filter(struct device *device, ...@@ -1115,9 +1113,11 @@ static ssize_t store_filter(struct device *device,
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Scancode filter not supported (but still accept 0) */ /* Can the scancode filter be set? */
if (!dev->s_filter && fattr->type != RC_FILTER_NORMAL) set_filter = (fattr->type == RC_FILTER_NORMAL) ? dev->s_filter :
return val ? -EINVAL : count; dev->s_wakeup_filter;
if (!set_filter)
return -EINVAL;
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
...@@ -1128,16 +1128,16 @@ static ssize_t store_filter(struct device *device, ...@@ -1128,16 +1128,16 @@ static ssize_t store_filter(struct device *device,
local_filter.mask = val; local_filter.mask = val;
else else
local_filter.data = val; local_filter.data = val;
if (!dev->enabled_protocols[fattr->type] && local_filter.mask) { if (!dev->enabled_protocols[fattr->type] && local_filter.mask) {
/* refuse to set a filter unless a protocol is enabled */ /* refuse to set a filter unless a protocol is enabled */
ret = -EINVAL; ret = -EINVAL;
goto unlock; goto unlock;
} }
if (dev->s_filter) {
ret = dev->s_filter(dev, fattr->type, &local_filter); ret = set_filter(dev, &local_filter);
if (ret < 0) if (ret < 0)
goto unlock; goto unlock;
}
/* Success, commit the new filter */ /* Success, commit the new filter */
*filter = local_filter; *filter = local_filter;
...@@ -1189,27 +1189,45 @@ static RC_FILTER_ATTR(wakeup_filter, S_IRUGO|S_IWUSR, ...@@ -1189,27 +1189,45 @@ static RC_FILTER_ATTR(wakeup_filter, S_IRUGO|S_IWUSR,
static RC_FILTER_ATTR(wakeup_filter_mask, S_IRUGO|S_IWUSR, static RC_FILTER_ATTR(wakeup_filter_mask, S_IRUGO|S_IWUSR,
show_filter, store_filter, RC_FILTER_WAKEUP, true); show_filter, store_filter, RC_FILTER_WAKEUP, true);
static struct attribute *rc_dev_attrs[] = { static struct attribute *rc_dev_protocol_attrs[] = {
&dev_attr_protocols.attr.attr, &dev_attr_protocols.attr.attr,
NULL,
};
static struct attribute_group rc_dev_protocol_attr_grp = {
.attrs = rc_dev_protocol_attrs,
};
static struct attribute *rc_dev_wakeup_protocol_attrs[] = {
&dev_attr_wakeup_protocols.attr.attr, &dev_attr_wakeup_protocols.attr.attr,
NULL,
};
static struct attribute_group rc_dev_wakeup_protocol_attr_grp = {
.attrs = rc_dev_wakeup_protocol_attrs,
};
static struct attribute *rc_dev_filter_attrs[] = {
&dev_attr_filter.attr.attr, &dev_attr_filter.attr.attr,
&dev_attr_filter_mask.attr.attr, &dev_attr_filter_mask.attr.attr,
&dev_attr_wakeup_filter.attr.attr,
&dev_attr_wakeup_filter_mask.attr.attr,
NULL, NULL,
}; };
static struct attribute_group rc_dev_attr_grp = { static struct attribute_group rc_dev_filter_attr_grp = {
.attrs = rc_dev_attrs, .attrs = rc_dev_filter_attrs,
}; };
static const struct attribute_group *rc_dev_attr_groups[] = { static struct attribute *rc_dev_wakeup_filter_attrs[] = {
&rc_dev_attr_grp, &dev_attr_wakeup_filter.attr.attr,
NULL &dev_attr_wakeup_filter_mask.attr.attr,
NULL,
};
static struct attribute_group rc_dev_wakeup_filter_attr_grp = {
.attrs = rc_dev_wakeup_filter_attrs,
}; };
static struct device_type rc_dev_type = { static struct device_type rc_dev_type = {
.groups = rc_dev_attr_groups,
.release = rc_dev_release, .release = rc_dev_release,
.uevent = rc_dev_uevent, .uevent = rc_dev_uevent,
}; };
...@@ -1266,7 +1284,7 @@ int rc_register_device(struct rc_dev *dev) ...@@ -1266,7 +1284,7 @@ int rc_register_device(struct rc_dev *dev)
static bool raw_init = false; /* raw decoders loaded? */ static bool raw_init = false; /* raw decoders loaded? */
struct rc_map *rc_map; struct rc_map *rc_map;
const char *path; const char *path;
int rc, devno; int rc, devno, attr = 0;
if (!dev || !dev->map_name) if (!dev || !dev->map_name)
return -EINVAL; return -EINVAL;
...@@ -1294,6 +1312,16 @@ int rc_register_device(struct rc_dev *dev) ...@@ -1294,6 +1312,16 @@ int rc_register_device(struct rc_dev *dev)
return -ENOMEM; return -ENOMEM;
} while (test_and_set_bit(devno, ir_core_dev_number)); } while (test_and_set_bit(devno, ir_core_dev_number));
dev->dev.groups = dev->sysfs_groups;
dev->sysfs_groups[attr++] = &rc_dev_protocol_attr_grp;
if (dev->s_filter)
dev->sysfs_groups[attr++] = &rc_dev_filter_attr_grp;
if (dev->s_wakeup_filter)
dev->sysfs_groups[attr++] = &rc_dev_wakeup_filter_attr_grp;
if (dev->change_wakeup_protocol)
dev->sysfs_groups[attr++] = &rc_dev_wakeup_protocol_attr_grp;
dev->sysfs_groups[attr++] = NULL;
/* /*
* Take the lock here, as the device sysfs node will appear * Take the lock here, as the device sysfs node will appear
* when device_add() is called, which may trigger an ir-keytable udev * when device_add() is called, which may trigger an ir-keytable udev
......
...@@ -1468,7 +1468,8 @@ static int r820t_imr_prepare(struct r820t_priv *priv) ...@@ -1468,7 +1468,8 @@ static int r820t_imr_prepare(struct r820t_priv *priv)
static int r820t_multi_read(struct r820t_priv *priv) static int r820t_multi_read(struct r820t_priv *priv)
{ {
int rc, i; int rc, i;
u8 data[2], min = 0, max = 255, sum = 0; u16 sum = 0;
u8 data[2], min = 255, max = 0;
usleep_range(5000, 6000); usleep_range(5000, 6000);
......
...@@ -1107,6 +1107,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, ...@@ -1107,6 +1107,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
offset += 200000; offset += 200000;
} }
#endif #endif
break;
default: default:
tuner_err("Unsupported tuner type %d.\n", new_type); tuner_err("Unsupported tuner type %d.\n", new_type);
break; break;
......
...@@ -1503,8 +1503,6 @@ static const struct usb_device_id rtl28xxu_id_table[] = { ...@@ -1503,8 +1503,6 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
/* RTL2832P devices: */ /* RTL2832P devices: */
{ DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131, { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131,
&rtl2832u_props, "Astrometa DVB-T2", NULL) }, &rtl2832u_props, "Astrometa DVB-T2", NULL) },
{ DVB_USB_DEVICE(USB_VID_KYE, 0x707f,
&rtl2832u_props, "Genius TVGo DVB-T03", NULL) },
{ } { }
}; };
MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table); MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
......
...@@ -154,7 +154,9 @@ static void jpeg_set_qual(u8 *jpeg_hdr, ...@@ -154,7 +154,9 @@ static void jpeg_set_qual(u8 *jpeg_hdr,
{ {
int i, sc; int i, sc;
if (quality < 50) if (quality <= 0)
sc = 5000;
else if (quality < 50)
sc = 5000 / quality; sc = 5000 / quality;
else else
sc = 200 - quality * 2; sc = 200 - quality * 2;
......
...@@ -108,7 +108,7 @@ int stk1160_ac97_register(struct stk1160 *dev) ...@@ -108,7 +108,7 @@ int stk1160_ac97_register(struct stk1160 *dev)
"stk1160-mixer"); "stk1160-mixer");
snprintf(card->longname, sizeof(card->longname), snprintf(card->longname, sizeof(card->longname),
"stk1160 ac97 codec mixer control"); "stk1160 ac97 codec mixer control");
strncpy(card->driver, dev->dev->driver->name, sizeof(card->driver)); strlcpy(card->driver, dev->dev->driver->name, sizeof(card->driver));
rc = snd_ac97_bus(card, 0, &stk1160_ac97_ops, NULL, &ac97_bus); rc = snd_ac97_bus(card, 0, &stk1160_ac97_ops, NULL, &ac97_bus);
if (rc) if (rc)
......
...@@ -201,7 +201,7 @@ static int msi001_set_tuner(struct msi001 *s) ...@@ -201,7 +201,7 @@ static int msi001_set_tuner(struct msi001 *s)
dev_dbg(&s->spi->dev, "%s: bandwidth selected=%d\n", dev_dbg(&s->spi->dev, "%s: bandwidth selected=%d\n",
__func__, bandwidth_lut[i].freq); __func__, bandwidth_lut[i].freq);
f_vco = (f_rf + f_if + f_if1) * lo_div; f_vco = (u64) (f_rf + f_if + f_if1) * lo_div;
tmp64 = f_vco; tmp64 = f_vco;
m = do_div(tmp64, F_REF * R_REF); m = do_div(tmp64, F_REF * R_REF);
n = (unsigned int) tmp64; n = (unsigned int) tmp64;
......
...@@ -913,7 +913,6 @@ static int msi3101_set_usb_adc(struct msi3101_state *s) ...@@ -913,7 +913,6 @@ static int msi3101_set_usb_adc(struct msi3101_state *s)
/* set tuner, subdev, filters according to sampling rate */ /* set tuner, subdev, filters according to sampling rate */
bandwidth_auto = v4l2_ctrl_find(&s->hdl, V4L2_CID_RF_TUNER_BANDWIDTH_AUTO); bandwidth_auto = v4l2_ctrl_find(&s->hdl, V4L2_CID_RF_TUNER_BANDWIDTH_AUTO);
bandwidth = v4l2_ctrl_find(&s->hdl, V4L2_CID_RF_TUNER_BANDWIDTH);
if (v4l2_ctrl_g_ctrl(bandwidth_auto)) { if (v4l2_ctrl_g_ctrl(bandwidth_auto)) {
bandwidth = v4l2_ctrl_find(&s->hdl, V4L2_CID_RF_TUNER_BANDWIDTH); bandwidth = v4l2_ctrl_find(&s->hdl, V4L2_CID_RF_TUNER_BANDWIDTH);
v4l2_ctrl_s_ctrl(bandwidth, s->f_adc); v4l2_ctrl_s_ctrl(bandwidth, s->f_adc);
...@@ -1078,6 +1077,7 @@ static int msi3101_start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -1078,6 +1077,7 @@ static int msi3101_start_streaming(struct vb2_queue *vq, unsigned int count)
static int msi3101_stop_streaming(struct vb2_queue *vq) static int msi3101_stop_streaming(struct vb2_queue *vq)
{ {
struct msi3101_state *s = vb2_get_drv_priv(vq); struct msi3101_state *s = vb2_get_drv_priv(vq);
int ret;
dev_dbg(&s->udev->dev, "%s:\n", __func__); dev_dbg(&s->udev->dev, "%s:\n", __func__);
if (mutex_lock_interruptible(&s->v4l2_lock)) if (mutex_lock_interruptible(&s->v4l2_lock))
...@@ -1090,17 +1090,22 @@ static int msi3101_stop_streaming(struct vb2_queue *vq) ...@@ -1090,17 +1090,22 @@ static int msi3101_stop_streaming(struct vb2_queue *vq)
/* according to tests, at least 700us delay is required */ /* according to tests, at least 700us delay is required */
msleep(20); msleep(20);
msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0); ret = msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0);
if (ret)
goto err_sleep_tuner;
/* sleep USB IF / ADC */ /* sleep USB IF / ADC */
msi3101_ctrl_msg(s, CMD_WREG, 0x01000003); ret = msi3101_ctrl_msg(s, CMD_WREG, 0x01000003);
if (ret)
goto err_sleep_tuner;
err_sleep_tuner:
/* sleep tuner */ /* sleep tuner */
v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0); ret = v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0);
mutex_unlock(&s->v4l2_lock); mutex_unlock(&s->v4l2_lock);
return 0; return ret;
} }
static struct vb2_ops msi3101_vb2_ops = { static struct vb2_ops msi3101_vb2_ops = {
......
...@@ -60,6 +60,7 @@ enum rc_filter_type { ...@@ -60,6 +60,7 @@ enum rc_filter_type {
/** /**
* struct rc_dev - represents a remote control device * struct rc_dev - represents a remote control device
* @dev: driver model's view of this device * @dev: driver model's view of this device
* @sysfs_groups: sysfs attribute groups
* @input_name: name of the input child device * @input_name: name of the input child device
* @input_phys: physical path to the input child device * @input_phys: physical path to the input child device
* @input_id: id of the input child device (struct input_id) * @input_id: id of the input child device (struct input_id)
...@@ -112,10 +113,12 @@ enum rc_filter_type { ...@@ -112,10 +113,12 @@ enum rc_filter_type {
* device doesn't interrupt host until it sees IR pulses * device doesn't interrupt host until it sees IR pulses
* @s_learning_mode: enable wide band receiver used for learning * @s_learning_mode: enable wide band receiver used for learning
* @s_carrier_report: enable carrier reports * @s_carrier_report: enable carrier reports
* @s_filter: set the scancode filter of a given type * @s_filter: set the scancode filter
* @s_wakeup_filter: set the wakeup scancode filter
*/ */
struct rc_dev { struct rc_dev {
struct device dev; struct device dev;
const struct attribute_group *sysfs_groups[5];
const char *input_name; const char *input_name;
const char *input_phys; const char *input_phys;
struct input_id input_id; struct input_id input_id;
...@@ -159,8 +162,9 @@ struct rc_dev { ...@@ -159,8 +162,9 @@ struct rc_dev {
int (*s_learning_mode)(struct rc_dev *dev, int enable); int (*s_learning_mode)(struct rc_dev *dev, int enable);
int (*s_carrier_report) (struct rc_dev *dev, int enable); int (*s_carrier_report) (struct rc_dev *dev, int enable);
int (*s_filter)(struct rc_dev *dev, int (*s_filter)(struct rc_dev *dev,
enum rc_filter_type type,
struct rc_scancode_filter *filter); struct rc_scancode_filter *filter);
int (*s_wakeup_filter)(struct rc_dev *dev,
struct rc_scancode_filter *filter);
}; };
#define to_rc_dev(d) container_of(d, struct rc_dev, dev) #define to_rc_dev(d) container_of(d, struct rc_dev, dev)
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#ifndef __V4L2_COMMON__ #ifndef __V4L2_COMMON__
#define __V4L2_COMMON__ #define __V4L2_COMMON__
#include <linux/types.h>
/* /*
* *
* Selection interface definitions * Selection interface definitions
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册