提交 62d7a292 编写于 作者: L Linus Torvalds

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

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (31 commits)
  Revert "[media] af9015: limit I2C access to keep FW happy"
  [media] s5p-fimc: Fix camera input configuration in subdev operations
  [media] m5mols: Fix logic in sanity check
  [media] ati_remote: switch to single-byte scancodes
  [media] V4L: mt9m111: fix uninitialised mutex
  [media] V4L: omap1_camera: fix missing <linux/module.h> include
  [media] V4L: mt9t112: use after free in mt9t112_probe()
  [media] V4L: soc-camera: fix compiler warnings on 64-bit platforms
  [media] s5p_mfc_enc: fix s/H264/H263/ typo
  [media] omap_vout: Fix compile error in 3.1
  [media] au0828: add missing models 72101, 72201 & 72261 to the model matrix
  [media] au0828: add missing USB ID 2040:7213
  [media] au0828: add missing USB ID 2040:7260
  [media] [trivial] omap24xxcam-dma: Fix logical test
  [media] omap_vout: fix crash if no driver for a display
  [media] media: video: s5p-tv: fix build break
  [media] omap3isp: fix compilation of ispvideo.c
  [media] m5mols: Fix set_fmt to return proper pixel format code
  [media] s5p-fimc: Use correct fourcc for RGB565 colour format
  [media] s5p-fimc: Fail driver probing when sensor configuration is wrong
  ...
...@@ -4281,7 +4281,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git ...@@ -4281,7 +4281,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
S: Maintained S: Maintained
F: Documentation/dvb/ F: Documentation/dvb/
F: Documentation/video4linux/ F: Documentation/video4linux/
F: Documentation/DocBook/media/
F: drivers/media/ F: drivers/media/
F: drivers/staging/media/
F: include/media/ F: include/media/
F: include/linux/dvb/ F: include/linux/dvb/
F: include/linux/videodev*.h F: include/linux/videodev*.h
......
...@@ -488,9 +488,10 @@ static int mxl5007t_write_regs(struct mxl5007t_state *state, ...@@ -488,9 +488,10 @@ static int mxl5007t_write_regs(struct mxl5007t_state *state,
static int mxl5007t_read_reg(struct mxl5007t_state *state, u8 reg, u8 *val) static int mxl5007t_read_reg(struct mxl5007t_state *state, u8 reg, u8 *val)
{ {
u8 buf[2] = { 0xfb, reg };
struct i2c_msg msg[] = { struct i2c_msg msg[] = {
{ .addr = state->i2c_props.addr, .flags = 0, { .addr = state->i2c_props.addr, .flags = 0,
.buf = &reg, .len = 1 }, .buf = buf, .len = 2 },
{ .addr = state->i2c_props.addr, .flags = I2C_M_RD, { .addr = state->i2c_props.addr, .flags = I2C_M_RD,
.buf = val, .len = 1 }, .buf = val, .len = 1 },
}; };
......
...@@ -141,7 +141,7 @@ static int tda18218_set_params(struct dvb_frontend *fe, ...@@ -141,7 +141,7 @@ static int tda18218_set_params(struct dvb_frontend *fe,
switch (params->u.ofdm.bandwidth) { switch (params->u.ofdm.bandwidth) {
case BANDWIDTH_6_MHZ: case BANDWIDTH_6_MHZ:
LP_Fc = 0; LP_Fc = 0;
LO_Frac = params->frequency + 4000000; LO_Frac = params->frequency + 3000000;
break; break;
case BANDWIDTH_7_MHZ: case BANDWIDTH_7_MHZ:
LP_Fc = 1; LP_Fc = 1;
......
...@@ -189,7 +189,7 @@ struct ati_remote { ...@@ -189,7 +189,7 @@ struct ati_remote {
dma_addr_t inbuf_dma; dma_addr_t inbuf_dma;
dma_addr_t outbuf_dma; dma_addr_t outbuf_dma;
unsigned char old_data[2]; /* Detect duplicate events */ unsigned char old_data; /* Detect duplicate events */
unsigned long old_jiffies; unsigned long old_jiffies;
unsigned long acc_jiffies; /* handle acceleration */ unsigned long acc_jiffies; /* handle acceleration */
unsigned long first_jiffies; unsigned long first_jiffies;
...@@ -221,35 +221,35 @@ struct ati_remote { ...@@ -221,35 +221,35 @@ struct ati_remote {
/* Translation table from hardware messages to input events. */ /* Translation table from hardware messages to input events. */
static const struct { static const struct {
short kind; short kind;
unsigned char data1, data2; unsigned char data;
int type; int type;
unsigned int code; unsigned int code;
int value; int value;
} ati_remote_tbl[] = { } ati_remote_tbl[] = {
/* Directional control pad axes */ /* Directional control pad axes */
{KIND_ACCEL, 0x35, 0x70, EV_REL, REL_X, -1}, /* left */ {KIND_ACCEL, 0x70, EV_REL, REL_X, -1}, /* left */
{KIND_ACCEL, 0x36, 0x71, EV_REL, REL_X, 1}, /* right */ {KIND_ACCEL, 0x71, EV_REL, REL_X, 1}, /* right */
{KIND_ACCEL, 0x37, 0x72, EV_REL, REL_Y, -1}, /* up */ {KIND_ACCEL, 0x72, EV_REL, REL_Y, -1}, /* up */
{KIND_ACCEL, 0x38, 0x73, EV_REL, REL_Y, 1}, /* down */ {KIND_ACCEL, 0x73, EV_REL, REL_Y, 1}, /* down */
/* Directional control pad diagonals */ /* Directional control pad diagonals */
{KIND_LU, 0x39, 0x74, EV_REL, 0, 0}, /* left up */ {KIND_LU, 0x74, EV_REL, 0, 0}, /* left up */
{KIND_RU, 0x3a, 0x75, EV_REL, 0, 0}, /* right up */ {KIND_RU, 0x75, EV_REL, 0, 0}, /* right up */
{KIND_LD, 0x3c, 0x77, EV_REL, 0, 0}, /* left down */ {KIND_LD, 0x77, EV_REL, 0, 0}, /* left down */
{KIND_RD, 0x3b, 0x76, EV_REL, 0, 0}, /* right down */ {KIND_RD, 0x76, EV_REL, 0, 0}, /* right down */
/* "Mouse button" buttons */ /* "Mouse button" buttons */
{KIND_LITERAL, 0x3d, 0x78, EV_KEY, BTN_LEFT, 1}, /* left btn down */ {KIND_LITERAL, 0x78, EV_KEY, BTN_LEFT, 1}, /* left btn down */
{KIND_LITERAL, 0x3e, 0x79, EV_KEY, BTN_LEFT, 0}, /* left btn up */ {KIND_LITERAL, 0x79, EV_KEY, BTN_LEFT, 0}, /* left btn up */
{KIND_LITERAL, 0x41, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */ {KIND_LITERAL, 0x7c, EV_KEY, BTN_RIGHT, 1},/* right btn down */
{KIND_LITERAL, 0x42, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */ {KIND_LITERAL, 0x7d, EV_KEY, BTN_RIGHT, 0},/* right btn up */
/* Artificial "doubleclick" events are generated by the hardware. /* Artificial "doubleclick" events are generated by the hardware.
* They are mapped to the "side" and "extra" mouse buttons here. */ * They are mapped to the "side" and "extra" mouse buttons here. */
{KIND_FILTERED, 0x3f, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */ {KIND_FILTERED, 0x7a, EV_KEY, BTN_SIDE, 1}, /* left dblclick */
{KIND_FILTERED, 0x43, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */ {KIND_FILTERED, 0x7e, EV_KEY, BTN_EXTRA, 1},/* right dblclick */
/* Non-mouse events are handled by rc-core */ /* Non-mouse events are handled by rc-core */
{KIND_END, 0x00, 0x00, EV_MAX + 1, 0, 0} {KIND_END, 0x00, EV_MAX + 1, 0, 0}
}; };
/* Local function prototypes */ /* Local function prototypes */
...@@ -396,25 +396,6 @@ static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigne ...@@ -396,25 +396,6 @@ static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigne
return retval; return retval;
} }
/*
* ati_remote_event_lookup
*/
static int ati_remote_event_lookup(int rem, unsigned char d1, unsigned char d2)
{
int i;
for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) {
/*
* Decide if the table entry matches the remote input.
*/
if (ati_remote_tbl[i].data1 == d1 &&
ati_remote_tbl[i].data2 == d2)
return i;
}
return -1;
}
/* /*
* ati_remote_compute_accel * ati_remote_compute_accel
* *
...@@ -463,7 +444,15 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -463,7 +444,15 @@ static void ati_remote_input_report(struct urb *urb)
int index = -1; int index = -1;
int acc; int acc;
int remote_num; int remote_num;
unsigned char scancode[2]; unsigned char scancode;
int i;
/*
* data[0] = 0x14
* data[1] = data[2] + data[3] + 0xd5 (a checksum byte)
* data[2] = the key code (with toggle bit in MSB with some models)
* data[3] = channel << 4 (the low 4 bits must be zero)
*/
/* Deal with strange looking inputs */ /* Deal with strange looking inputs */
if ( (urb->actual_length != 4) || (data[0] != 0x14) || if ( (urb->actual_length != 4) || (data[0] != 0x14) ||
...@@ -472,6 +461,13 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -472,6 +461,13 @@ static void ati_remote_input_report(struct urb *urb)
return; return;
} }
if (data[1] != ((data[2] + data[3] + 0xd5) & 0xff)) {
dbginfo(&ati_remote->interface->dev,
"wrong checksum in input: %02x %02x %02x %02x\n",
data[0], data[1], data[2], data[3]);
return;
}
/* Mask unwanted remote channels. */ /* Mask unwanted remote channels. */
/* note: remote_num is 0-based, channel 1 on remote == 0 here */ /* note: remote_num is 0-based, channel 1 on remote == 0 here */
remote_num = (data[3] >> 4) & 0x0f; remote_num = (data[3] >> 4) & 0x0f;
...@@ -482,31 +478,30 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -482,31 +478,30 @@ static void ati_remote_input_report(struct urb *urb)
return; return;
} }
scancode[0] = (((data[1] - ((remote_num + 1) << 4)) & 0xf0) | (data[1] & 0x0f));
/* /*
* Some devices (e.g. SnapStream Firefly) use 8080 as toggle code, * MSB is a toggle code, though only used by some devices
* so we have to clear them. The first bit is a bit tricky as the * (e.g. SnapStream Firefly)
* "non-toggled" state depends on remote_num, so we xor it with the
* second bit which is only used for toggle.
*/ */
scancode[0] ^= (data[2] & 0x80); scancode = data[2] & 0x7f;
scancode[1] = data[2] & ~0x80;
/* Look up event code index in mouse translation table. */ /* Look up event code index in the mouse translation table. */
index = ati_remote_event_lookup(remote_num, scancode[0], scancode[1]); for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) {
if (scancode == ati_remote_tbl[i].data) {
index = i;
break;
}
}
if (index >= 0) { if (index >= 0) {
dbginfo(&ati_remote->interface->dev, dbginfo(&ati_remote->interface->dev,
"channel 0x%02x; mouse data %02x,%02x; index %d; keycode %d\n", "channel 0x%02x; mouse data %02x; index %d; keycode %d\n",
remote_num, data[1], data[2], index, ati_remote_tbl[index].code); remote_num, data[2], index, ati_remote_tbl[index].code);
if (!dev) if (!dev)
return; /* no mouse device */ return; /* no mouse device */
} else } else
dbginfo(&ati_remote->interface->dev, dbginfo(&ati_remote->interface->dev,
"channel 0x%02x; key data %02x,%02x, scancode %02x,%02x\n", "channel 0x%02x; key data %02x, scancode %02x\n",
remote_num, data[1], data[2], scancode[0], scancode[1]); remote_num, data[2], scancode);
if (index >= 0 && ati_remote_tbl[index].kind == KIND_LITERAL) { if (index >= 0 && ati_remote_tbl[index].kind == KIND_LITERAL) {
...@@ -523,8 +518,7 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -523,8 +518,7 @@ static void ati_remote_input_report(struct urb *urb)
unsigned long now = jiffies; unsigned long now = jiffies;
/* Filter duplicate events which happen "too close" together. */ /* Filter duplicate events which happen "too close" together. */
if (ati_remote->old_data[0] == data[1] && if (ati_remote->old_data == data[2] &&
ati_remote->old_data[1] == data[2] &&
time_before(now, ati_remote->old_jiffies + time_before(now, ati_remote->old_jiffies +
msecs_to_jiffies(repeat_filter))) { msecs_to_jiffies(repeat_filter))) {
ati_remote->repeat_count++; ati_remote->repeat_count++;
...@@ -533,8 +527,7 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -533,8 +527,7 @@ static void ati_remote_input_report(struct urb *urb)
ati_remote->first_jiffies = now; ati_remote->first_jiffies = now;
} }
ati_remote->old_data[0] = data[1]; ati_remote->old_data = data[2];
ati_remote->old_data[1] = data[2];
ati_remote->old_jiffies = now; ati_remote->old_jiffies = now;
/* Ensure we skip at least the 4 first duplicate events (generated /* Ensure we skip at least the 4 first duplicate events (generated
...@@ -549,14 +542,13 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -549,14 +542,13 @@ static void ati_remote_input_report(struct urb *urb)
if (index < 0) { if (index < 0) {
/* Not a mouse event, hand it to rc-core. */ /* Not a mouse event, hand it to rc-core. */
u32 rc_code = (scancode[0] << 8) | scancode[1];
/* /*
* We don't use the rc-core repeat handling yet as * We don't use the rc-core repeat handling yet as
* it would cause ghost repeats which would be a * it would cause ghost repeats which would be a
* regression for this driver. * regression for this driver.
*/ */
rc_keydown_notimeout(ati_remote->rdev, rc_code, rc_keydown_notimeout(ati_remote->rdev, scancode,
data[2]); data[2]);
rc_keyup(ati_remote->rdev); rc_keyup(ati_remote->rdev);
return; return;
...@@ -607,8 +599,7 @@ static void ati_remote_input_report(struct urb *urb) ...@@ -607,8 +599,7 @@ static void ati_remote_input_report(struct urb *urb)
input_sync(dev); input_sync(dev);
ati_remote->old_jiffies = jiffies; ati_remote->old_jiffies = jiffies;
ati_remote->old_data[0] = data[1]; ati_remote->old_data = data[2];
ati_remote->old_data[1] = data[2];
} }
} }
......
...@@ -27,55 +27,55 @@ ...@@ -27,55 +27,55 @@
#include <media/rc-map.h> #include <media/rc-map.h>
static struct rc_map_table ati_x10[] = { static struct rc_map_table ati_x10[] = {
{ 0xd20d, KEY_1 }, { 0x0d, KEY_1 },
{ 0xd30e, KEY_2 }, { 0x0e, KEY_2 },
{ 0xd40f, KEY_3 }, { 0x0f, KEY_3 },
{ 0xd510, KEY_4 }, { 0x10, KEY_4 },
{ 0xd611, KEY_5 }, { 0x11, KEY_5 },
{ 0xd712, KEY_6 }, { 0x12, KEY_6 },
{ 0xd813, KEY_7 }, { 0x13, KEY_7 },
{ 0xd914, KEY_8 }, { 0x14, KEY_8 },
{ 0xda15, KEY_9 }, { 0x15, KEY_9 },
{ 0xdc17, KEY_0 }, { 0x17, KEY_0 },
{ 0xc500, KEY_A }, { 0x00, KEY_A },
{ 0xc601, KEY_B }, { 0x01, KEY_B },
{ 0xde19, KEY_C }, { 0x19, KEY_C },
{ 0xe01b, KEY_D }, { 0x1b, KEY_D },
{ 0xe621, KEY_E }, { 0x21, KEY_E },
{ 0xe823, KEY_F }, { 0x23, KEY_F },
{ 0xdd18, KEY_KPENTER }, /* "check" */ { 0x18, KEY_KPENTER }, /* "check" */
{ 0xdb16, KEY_MENU }, /* "menu" */ { 0x16, KEY_MENU }, /* "menu" */
{ 0xc702, KEY_POWER }, /* Power */ { 0x02, KEY_POWER }, /* Power */
{ 0xc803, KEY_TV }, /* TV */ { 0x03, KEY_TV }, /* TV */
{ 0xc904, KEY_DVD }, /* DVD */ { 0x04, KEY_DVD }, /* DVD */
{ 0xca05, KEY_WWW }, /* WEB */ { 0x05, KEY_WWW }, /* WEB */
{ 0xcb06, KEY_BOOKMARKS }, /* "book" */ { 0x06, KEY_BOOKMARKS }, /* "book" */
{ 0xcc07, KEY_EDIT }, /* "hand" */ { 0x07, KEY_EDIT }, /* "hand" */
{ 0xe11c, KEY_COFFEE }, /* "timer" */ { 0x1c, KEY_COFFEE }, /* "timer" */
{ 0xe520, KEY_FRONT }, /* "max" */ { 0x20, KEY_FRONT }, /* "max" */
{ 0xe21d, KEY_LEFT }, /* left */ { 0x1d, KEY_LEFT }, /* left */
{ 0xe41f, KEY_RIGHT }, /* right */ { 0x1f, KEY_RIGHT }, /* right */
{ 0xe722, KEY_DOWN }, /* down */ { 0x22, KEY_DOWN }, /* down */
{ 0xdf1a, KEY_UP }, /* up */ { 0x1a, KEY_UP }, /* up */
{ 0xe31e, KEY_OK }, /* "OK" */ { 0x1e, KEY_OK }, /* "OK" */
{ 0xce09, KEY_VOLUMEDOWN }, /* VOL + */ { 0x09, KEY_VOLUMEDOWN }, /* VOL + */
{ 0xcd08, KEY_VOLUMEUP }, /* VOL - */ { 0x08, KEY_VOLUMEUP }, /* VOL - */
{ 0xcf0a, KEY_MUTE }, /* MUTE */ { 0x0a, KEY_MUTE }, /* MUTE */
{ 0xd00b, KEY_CHANNELUP }, /* CH + */ { 0x0b, KEY_CHANNELUP }, /* CH + */
{ 0xd10c, KEY_CHANNELDOWN },/* CH - */ { 0x0c, KEY_CHANNELDOWN },/* CH - */
{ 0xec27, KEY_RECORD }, /* ( o) red */ { 0x27, KEY_RECORD }, /* ( o) red */
{ 0xea25, KEY_PLAY }, /* ( >) */ { 0x25, KEY_PLAY }, /* ( >) */
{ 0xe924, KEY_REWIND }, /* (<<) */ { 0x24, KEY_REWIND }, /* (<<) */
{ 0xeb26, KEY_FORWARD }, /* (>>) */ { 0x26, KEY_FORWARD }, /* (>>) */
{ 0xed28, KEY_STOP }, /* ([]) */ { 0x28, KEY_STOP }, /* ([]) */
{ 0xee29, KEY_PAUSE }, /* ('') */ { 0x29, KEY_PAUSE }, /* ('') */
{ 0xf02b, KEY_PREVIOUS }, /* (<-) */ { 0x2b, KEY_PREVIOUS }, /* (<-) */
{ 0xef2a, KEY_NEXT }, /* (>+) */ { 0x2a, KEY_NEXT }, /* (>+) */
{ 0xf22d, KEY_INFO }, /* PLAYING */ { 0x2d, KEY_INFO }, /* PLAYING */
{ 0xf32e, KEY_HOME }, /* TOP */ { 0x2e, KEY_HOME }, /* TOP */
{ 0xf42f, KEY_END }, /* END */ { 0x2f, KEY_END }, /* END */
{ 0xf530, KEY_SELECT }, /* SELECT */ { 0x30, KEY_SELECT }, /* SELECT */
}; };
static struct rc_map_list ati_x10_map = { static struct rc_map_list ati_x10_map = {
......
...@@ -25,70 +25,70 @@ ...@@ -25,70 +25,70 @@
#include <media/rc-map.h> #include <media/rc-map.h>
static struct rc_map_table medion_x10[] = { static struct rc_map_table medion_x10[] = {
{ 0xf12c, KEY_TV }, /* TV */ { 0x2c, KEY_TV }, /* TV */
{ 0xf22d, KEY_VCR }, /* VCR */ { 0x2d, KEY_VCR }, /* VCR */
{ 0xc904, KEY_DVD }, /* DVD */ { 0x04, KEY_DVD }, /* DVD */
{ 0xcb06, KEY_AUDIO }, /* MUSIC */ { 0x06, KEY_AUDIO }, /* MUSIC */
{ 0xf32e, KEY_RADIO }, /* RADIO */ { 0x2e, KEY_RADIO }, /* RADIO */
{ 0xca05, KEY_DIRECTORY }, /* PHOTO */ { 0x05, KEY_DIRECTORY }, /* PHOTO */
{ 0xf42f, KEY_INFO }, /* TV-PREVIEW */ { 0x2f, KEY_INFO }, /* TV-PREVIEW */
{ 0xf530, KEY_LIST }, /* CHANNEL-LST */ { 0x30, KEY_LIST }, /* CHANNEL-LST */
{ 0xe01b, KEY_SETUP }, /* SETUP */ { 0x1b, KEY_SETUP }, /* SETUP */
{ 0xf631, KEY_VIDEO }, /* VIDEO DESKTOP */ { 0x31, KEY_VIDEO }, /* VIDEO DESKTOP */
{ 0xcd08, KEY_VOLUMEDOWN }, /* VOL - */ { 0x08, KEY_VOLUMEDOWN }, /* VOL - */
{ 0xce09, KEY_VOLUMEUP }, /* VOL + */ { 0x09, KEY_VOLUMEUP }, /* VOL + */
{ 0xd00b, KEY_CHANNELUP }, /* CHAN + */ { 0x0b, KEY_CHANNELUP }, /* CHAN + */
{ 0xd10c, KEY_CHANNELDOWN }, /* CHAN - */ { 0x0c, KEY_CHANNELDOWN }, /* CHAN - */
{ 0xc500, KEY_MUTE }, /* MUTE */ { 0x00, KEY_MUTE }, /* MUTE */
{ 0xf732, KEY_RED }, /* red */ { 0x32, KEY_RED }, /* red */
{ 0xf833, KEY_GREEN }, /* green */ { 0x33, KEY_GREEN }, /* green */
{ 0xf934, KEY_YELLOW }, /* yellow */ { 0x34, KEY_YELLOW }, /* yellow */
{ 0xfa35, KEY_BLUE }, /* blue */ { 0x35, KEY_BLUE }, /* blue */
{ 0xdb16, KEY_TEXT }, /* TXT */ { 0x16, KEY_TEXT }, /* TXT */
{ 0xd20d, KEY_1 }, { 0x0d, KEY_1 },
{ 0xd30e, KEY_2 }, { 0x0e, KEY_2 },
{ 0xd40f, KEY_3 }, { 0x0f, KEY_3 },
{ 0xd510, KEY_4 }, { 0x10, KEY_4 },
{ 0xd611, KEY_5 }, { 0x11, KEY_5 },
{ 0xd712, KEY_6 }, { 0x12, KEY_6 },
{ 0xd813, KEY_7 }, { 0x13, KEY_7 },
{ 0xd914, KEY_8 }, { 0x14, KEY_8 },
{ 0xda15, KEY_9 }, { 0x15, KEY_9 },
{ 0xdc17, KEY_0 }, { 0x17, KEY_0 },
{ 0xe11c, KEY_SEARCH }, /* TV/RAD, CH SRC */ { 0x1c, KEY_SEARCH }, /* TV/RAD, CH SRC */
{ 0xe520, KEY_DELETE }, /* DELETE */ { 0x20, KEY_DELETE }, /* DELETE */
{ 0xfb36, KEY_KEYBOARD }, /* RENAME */ { 0x36, KEY_KEYBOARD }, /* RENAME */
{ 0xdd18, KEY_SCREEN }, /* SNAPSHOT */ { 0x18, KEY_SCREEN }, /* SNAPSHOT */
{ 0xdf1a, KEY_UP }, /* up */ { 0x1a, KEY_UP }, /* up */
{ 0xe722, KEY_DOWN }, /* down */ { 0x22, KEY_DOWN }, /* down */
{ 0xe21d, KEY_LEFT }, /* left */ { 0x1d, KEY_LEFT }, /* left */
{ 0xe41f, KEY_RIGHT }, /* right */ { 0x1f, KEY_RIGHT }, /* right */
{ 0xe31e, KEY_OK }, /* OK */ { 0x1e, KEY_OK }, /* OK */
{ 0xfc37, KEY_SELECT }, /* ACQUIRE IMAGE */ { 0x37, KEY_SELECT }, /* ACQUIRE IMAGE */
{ 0xfd38, KEY_EDIT }, /* EDIT IMAGE */ { 0x38, KEY_EDIT }, /* EDIT IMAGE */
{ 0xe924, KEY_REWIND }, /* rewind (<<) */ { 0x24, KEY_REWIND }, /* rewind (<<) */
{ 0xea25, KEY_PLAY }, /* play ( >) */ { 0x25, KEY_PLAY }, /* play ( >) */
{ 0xeb26, KEY_FORWARD }, /* forward (>>) */ { 0x26, KEY_FORWARD }, /* forward (>>) */
{ 0xec27, KEY_RECORD }, /* record ( o) */ { 0x27, KEY_RECORD }, /* record ( o) */
{ 0xed28, KEY_STOP }, /* stop ([]) */ { 0x28, KEY_STOP }, /* stop ([]) */
{ 0xee29, KEY_PAUSE }, /* pause ('') */ { 0x29, KEY_PAUSE }, /* pause ('') */
{ 0xe621, KEY_PREVIOUS }, /* prev */ { 0x21, KEY_PREVIOUS }, /* prev */
{ 0xfe39, KEY_SWITCHVIDEOMODE }, /* F SCR */ { 0x39, KEY_SWITCHVIDEOMODE }, /* F SCR */
{ 0xe823, KEY_NEXT }, /* next */ { 0x23, KEY_NEXT }, /* next */
{ 0xde19, KEY_MENU }, /* MENU */ { 0x19, KEY_MENU }, /* MENU */
{ 0xff3a, KEY_LANGUAGE }, /* AUDIO */ { 0x3a, KEY_LANGUAGE }, /* AUDIO */
{ 0xc702, KEY_POWER }, /* POWER */ { 0x02, KEY_POWER }, /* POWER */
}; };
static struct rc_map_list medion_x10_map = { static struct rc_map_list medion_x10_map = {
......
...@@ -22,63 +22,63 @@ ...@@ -22,63 +22,63 @@
#include <media/rc-map.h> #include <media/rc-map.h>
static struct rc_map_table snapstream_firefly[] = { static struct rc_map_table snapstream_firefly[] = {
{ 0xf12c, KEY_ZOOM }, /* Maximize */ { 0x2c, KEY_ZOOM }, /* Maximize */
{ 0xc702, KEY_CLOSE }, { 0x02, KEY_CLOSE },
{ 0xd20d, KEY_1 }, { 0x0d, KEY_1 },
{ 0xd30e, KEY_2 }, { 0x0e, KEY_2 },
{ 0xd40f, KEY_3 }, { 0x0f, KEY_3 },
{ 0xd510, KEY_4 }, { 0x10, KEY_4 },
{ 0xd611, KEY_5 }, { 0x11, KEY_5 },
{ 0xd712, KEY_6 }, { 0x12, KEY_6 },
{ 0xd813, KEY_7 }, { 0x13, KEY_7 },
{ 0xd914, KEY_8 }, { 0x14, KEY_8 },
{ 0xda15, KEY_9 }, { 0x15, KEY_9 },
{ 0xdc17, KEY_0 }, { 0x17, KEY_0 },
{ 0xdb16, KEY_BACK }, { 0x16, KEY_BACK },
{ 0xdd18, KEY_KPENTER }, /* ent */ { 0x18, KEY_KPENTER }, /* ent */
{ 0xce09, KEY_VOLUMEUP }, { 0x09, KEY_VOLUMEUP },
{ 0xcd08, KEY_VOLUMEDOWN }, { 0x08, KEY_VOLUMEDOWN },
{ 0xcf0a, KEY_MUTE }, { 0x0a, KEY_MUTE },
{ 0xd00b, KEY_CHANNELUP }, { 0x0b, KEY_CHANNELUP },
{ 0xd10c, KEY_CHANNELDOWN }, { 0x0c, KEY_CHANNELDOWN },
{ 0xc500, KEY_VENDOR }, /* firefly */ { 0x00, KEY_VENDOR }, /* firefly */
{ 0xf32e, KEY_INFO }, { 0x2e, KEY_INFO },
{ 0xf42f, KEY_OPTION }, { 0x2f, KEY_OPTION },
{ 0xe21d, KEY_LEFT }, { 0x1d, KEY_LEFT },
{ 0xe41f, KEY_RIGHT }, { 0x1f, KEY_RIGHT },
{ 0xe722, KEY_DOWN }, { 0x22, KEY_DOWN },
{ 0xdf1a, KEY_UP }, { 0x1a, KEY_UP },
{ 0xe31e, KEY_OK }, { 0x1e, KEY_OK },
{ 0xe11c, KEY_MENU }, { 0x1c, KEY_MENU },
{ 0xe520, KEY_EXIT }, { 0x20, KEY_EXIT },
{ 0xec27, KEY_RECORD }, { 0x27, KEY_RECORD },
{ 0xea25, KEY_PLAY }, { 0x25, KEY_PLAY },
{ 0xed28, KEY_STOP }, { 0x28, KEY_STOP },
{ 0xe924, KEY_REWIND }, { 0x24, KEY_REWIND },
{ 0xeb26, KEY_FORWARD }, { 0x26, KEY_FORWARD },
{ 0xee29, KEY_PAUSE }, { 0x29, KEY_PAUSE },
{ 0xf02b, KEY_PREVIOUS }, { 0x2b, KEY_PREVIOUS },
{ 0xef2a, KEY_NEXT }, { 0x2a, KEY_NEXT },
{ 0xcb06, KEY_AUDIO }, /* Music */ { 0x06, KEY_AUDIO }, /* Music */
{ 0xca05, KEY_IMAGES }, /* Photos */ { 0x05, KEY_IMAGES }, /* Photos */
{ 0xc904, KEY_DVD }, { 0x04, KEY_DVD },
{ 0xc803, KEY_TV }, { 0x03, KEY_TV },
{ 0xcc07, KEY_VIDEO }, { 0x07, KEY_VIDEO },
{ 0xc601, KEY_HELP }, { 0x01, KEY_HELP },
{ 0xf22d, KEY_MODE }, /* Mouse */ { 0x2d, KEY_MODE }, /* Mouse */
{ 0xde19, KEY_A }, { 0x19, KEY_A },
{ 0xe01b, KEY_B }, { 0x1b, KEY_B },
{ 0xe621, KEY_C }, { 0x21, KEY_C },
{ 0xe823, KEY_D }, { 0x23, KEY_D },
}; };
static struct rc_map_list snapstream_firefly_map = { static struct rc_map_list snapstream_firefly_map = {
......
...@@ -162,11 +162,14 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data) ...@@ -162,11 +162,14 @@ static void hauppauge_eeprom(struct au0828_dev *dev, u8 *eeprom_data)
switch (tv.model) { switch (tv.model) {
case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */ case 72000: /* WinTV-HVR950q (Retail, IR, ATSC/QAM */
case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ case 72001: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
case 72101: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
case 72201: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ case 72211: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ case 72221: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */ case 72231: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */ case 72241: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM and analog video */
case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */ case 72251: /* WinTV-HVR950q (Retail, IR, ATSC/QAM and analog video */
case 72261: /* WinTV-HVR950q (OEM, IR, ATSC/QAM and analog video */
case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */ case 72301: /* WinTV-HVR850 (Retail, IR, ATSC and analog video */
case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */ case 72500: /* WinTV-HVR950q (OEM, No IR, ATSC/QAM */
break; break;
...@@ -324,6 +327,10 @@ struct usb_device_id au0828_usb_id_table[] = { ...@@ -324,6 +327,10 @@ struct usb_device_id au0828_usb_id_table[] = {
.driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL }, .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
{ USB_DEVICE(0x2040, 0x8200), { USB_DEVICE(0x2040, 0x8200),
.driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY }, .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY },
{ USB_DEVICE(0x2040, 0x7260),
.driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
{ USB_DEVICE(0x2040, 0x7213),
.driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
{ }, { },
}; };
......
...@@ -162,7 +162,6 @@ struct m5mols_version { ...@@ -162,7 +162,6 @@ struct m5mols_version {
* @pad: media pad * @pad: media pad
* @ffmt: current fmt according to resolution type * @ffmt: current fmt according to resolution type
* @res_type: current resolution type * @res_type: current resolution type
* @code: current code
* @irq_waitq: waitqueue for the capture * @irq_waitq: waitqueue for the capture
* @work_irq: workqueue for the IRQ * @work_irq: workqueue for the IRQ
* @flags: state variable for the interrupt handler * @flags: state variable for the interrupt handler
...@@ -192,7 +191,6 @@ struct m5mols_info { ...@@ -192,7 +191,6 @@ struct m5mols_info {
struct media_pad pad; struct media_pad pad;
struct v4l2_mbus_framefmt ffmt[M5MOLS_RESTYPE_MAX]; struct v4l2_mbus_framefmt ffmt[M5MOLS_RESTYPE_MAX];
int res_type; int res_type;
enum v4l2_mbus_pixelcode code;
wait_queue_head_t irq_waitq; wait_queue_head_t irq_waitq;
struct work_struct work_irq; struct work_struct work_irq;
unsigned long flags; unsigned long flags;
......
...@@ -334,7 +334,7 @@ int m5mols_mode(struct m5mols_info *info, u8 mode) ...@@ -334,7 +334,7 @@ int m5mols_mode(struct m5mols_info *info, u8 mode)
int ret = -EINVAL; int ret = -EINVAL;
u8 reg; u8 reg;
if (mode < REG_PARAMETER && mode > REG_CAPTURE) if (mode < REG_PARAMETER || mode > REG_CAPTURE)
return ret; return ret;
ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg); ret = m5mols_read_u8(sd, SYSTEM_SYSMODE, &reg);
...@@ -511,9 +511,6 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, ...@@ -511,9 +511,6 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
struct m5mols_info *info = to_m5mols(sd); struct m5mols_info *info = to_m5mols(sd);
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
if (fmt->pad != 0)
return -EINVAL;
format = __find_format(info, fh, fmt->which, info->res_type); format = __find_format(info, fh, fmt->which, info->res_type);
if (!format) if (!format)
return -EINVAL; return -EINVAL;
...@@ -532,9 +529,6 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, ...@@ -532,9 +529,6 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
u32 resolution = 0; u32 resolution = 0;
int ret; int ret;
if (fmt->pad != 0)
return -EINVAL;
ret = __find_resolution(sd, format, &type, &resolution); ret = __find_resolution(sd, format, &type, &resolution);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -543,13 +537,14 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, ...@@ -543,13 +537,14 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
if (!sfmt) if (!sfmt)
return 0; return 0;
*sfmt = m5mols_default_ffmt[type];
sfmt->width = format->width; format->code = m5mols_default_ffmt[type].code;
sfmt->height = format->height; format->colorspace = V4L2_COLORSPACE_JPEG;
format->field = V4L2_FIELD_NONE;
if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
*sfmt = *format;
info->resolution = resolution; info->resolution = resolution;
info->code = format->code;
info->res_type = type; info->res_type = type;
} }
...@@ -626,13 +621,14 @@ static int m5mols_start_monitor(struct m5mols_info *info) ...@@ -626,13 +621,14 @@ static int m5mols_start_monitor(struct m5mols_info *info)
static int m5mols_s_stream(struct v4l2_subdev *sd, int enable) static int m5mols_s_stream(struct v4l2_subdev *sd, int enable)
{ {
struct m5mols_info *info = to_m5mols(sd); struct m5mols_info *info = to_m5mols(sd);
u32 code = info->ffmt[info->res_type].code;
if (enable) { if (enable) {
int ret = -EINVAL; int ret = -EINVAL;
if (is_code(info->code, M5MOLS_RESTYPE_MONITOR)) if (is_code(code, M5MOLS_RESTYPE_MONITOR))
ret = m5mols_start_monitor(info); ret = m5mols_start_monitor(info);
if (is_code(info->code, M5MOLS_RESTYPE_CAPTURE)) if (is_code(code, M5MOLS_RESTYPE_CAPTURE))
ret = m5mols_start_capture(info); ret = m5mols_start_capture(info);
return ret; return ret;
......
...@@ -955,6 +955,7 @@ static int mt9m111_probe(struct i2c_client *client, ...@@ -955,6 +955,7 @@ static int mt9m111_probe(struct i2c_client *client,
mt9m111->rect.height = MT9M111_MAX_HEIGHT; mt9m111->rect.height = MT9M111_MAX_HEIGHT;
mt9m111->fmt = &mt9m111_colour_fmts[0]; mt9m111->fmt = &mt9m111_colour_fmts[0];
mt9m111->lastpage = -1; mt9m111->lastpage = -1;
mutex_init(&mt9m111->power_lock);
ret = mt9m111_video_probe(client); ret = mt9m111_video_probe(client);
if (ret) { if (ret) {
......
...@@ -1083,8 +1083,10 @@ static int mt9t112_probe(struct i2c_client *client, ...@@ -1083,8 +1083,10 @@ static int mt9t112_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops);
ret = mt9t112_camera_probe(client); ret = mt9t112_camera_probe(client);
if (ret) if (ret) {
kfree(priv); kfree(priv);
return ret;
}
/* Cannot fail: using the default supported pixel code */ /* Cannot fail: using the default supported pixel code */
mt9t112_set_params(priv, &rect, V4L2_MBUS_FMT_UYVY8_2X8); mt9t112_set_params(priv, &rect, V4L2_MBUS_FMT_UYVY8_2X8);
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <media/videobuf-dma-contig.h> #include <media/videobuf-dma-contig.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
...@@ -2169,6 +2170,14 @@ static int __init omap_vout_probe(struct platform_device *pdev) ...@@ -2169,6 +2170,14 @@ static int __init omap_vout_probe(struct platform_device *pdev)
vid_dev->num_displays = 0; vid_dev->num_displays = 0;
for_each_dss_dev(dssdev) { for_each_dss_dev(dssdev) {
omap_dss_get_device(dssdev); omap_dss_get_device(dssdev);
if (!dssdev->driver) {
dev_warn(&pdev->dev, "no driver for display: %s\n",
dssdev->name);
omap_dss_put_device(dssdev);
continue;
}
vid_dev->displays[vid_dev->num_displays++] = dssdev; vid_dev->displays[vid_dev->num_displays++] = dssdev;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -506,7 +506,7 @@ int omap24xxcam_sgdma_queue(struct omap24xxcam_sgdma *sgdma, ...@@ -506,7 +506,7 @@ int omap24xxcam_sgdma_queue(struct omap24xxcam_sgdma *sgdma,
unsigned long flags; unsigned long flags;
struct sgdma_state *sg_state; struct sgdma_state *sg_state;
if ((sglen < 0) || ((sglen > 0) & !sglist)) if ((sglen < 0) || ((sglen > 0) && !sglist))
return -EINVAL; return -EINVAL;
spin_lock_irqsave(&sgdma->lock, flags); spin_lock_irqsave(&sgdma->lock, flags);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/sched.h> #include <linux/sched.h>
......
...@@ -540,7 +540,7 @@ static u8 to_clkrc(struct v4l2_fract *timeperframe, ...@@ -540,7 +540,7 @@ static u8 to_clkrc(struct v4l2_fract *timeperframe,
static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{ {
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
struct soc_camera_sense *sense = icd->sense; struct soc_camera_sense *sense = icd->sense;
struct ov6650 *priv = to_ov6650(client); struct ov6650 *priv = to_ov6650(client);
bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect); bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect);
......
...@@ -98,6 +98,10 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend) ...@@ -98,6 +98,10 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
} }
set_bit(ST_CAPT_SUSPENDED, &fimc->state); set_bit(ST_CAPT_SUSPENDED, &fimc->state);
fimc_hw_reset(fimc);
cap->buf_index = 0;
spin_unlock_irqrestore(&fimc->slock, flags); spin_unlock_irqrestore(&fimc->slock, flags);
if (streaming) if (streaming)
...@@ -137,7 +141,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx) ...@@ -137,7 +141,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx)
struct fimc_dev *fimc = ctx->fimc_dev; struct fimc_dev *fimc = ctx->fimc_dev;
int ret; int ret;
if (test_bit(ST_CAPT_APPLY_CFG, &fimc->state)) if (!test_bit(ST_CAPT_APPLY_CFG, &fimc->state))
return 0; return 0;
spin_lock(&ctx->slock); spin_lock(&ctx->slock);
...@@ -150,7 +154,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx) ...@@ -150,7 +154,7 @@ int fimc_capture_config_update(struct fimc_ctx *ctx)
fimc_hw_set_rotation(ctx); fimc_hw_set_rotation(ctx);
fimc_prepare_dma_offset(ctx, &ctx->d_frame); fimc_prepare_dma_offset(ctx, &ctx->d_frame);
fimc_hw_set_out_dma(ctx); fimc_hw_set_out_dma(ctx);
set_bit(ST_CAPT_APPLY_CFG, &fimc->state); clear_bit(ST_CAPT_APPLY_CFG, &fimc->state);
} }
spin_unlock(&ctx->slock); spin_unlock(&ctx->slock);
return ret; return ret;
...@@ -164,7 +168,6 @@ static int start_streaming(struct vb2_queue *q, unsigned int count) ...@@ -164,7 +168,6 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
int min_bufs; int min_bufs;
int ret; int ret;
fimc_hw_reset(fimc);
vid_cap->frame_count = 0; vid_cap->frame_count = 0;
ret = fimc_init_capture(fimc); ret = fimc_init_capture(fimc);
...@@ -523,7 +526,7 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx, ...@@ -523,7 +526,7 @@ static struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx,
max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w; max_w = rotation ? pl->out_rot_en_w : pl->out_rot_dis_w;
min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize; min_w = ctx->state & FIMC_DST_CROP ? dst->width : var->min_out_pixsize;
min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize; min_h = ctx->state & FIMC_DST_CROP ? dst->height : var->min_out_pixsize;
if (fimc->id == 1 && var->pix_hoff) if (var->min_vsize_align == 1 && !rotation)
align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1; align_h = fimc_fmt_is_rgb(ffmt->color) ? 0 : 1;
depth = fimc_get_format_depth(ffmt); depth = fimc_get_format_depth(ffmt);
...@@ -1239,6 +1242,7 @@ static int fimc_subdev_set_fmt(struct v4l2_subdev *sd, ...@@ -1239,6 +1242,7 @@ static int fimc_subdev_set_fmt(struct v4l2_subdev *sd,
mutex_lock(&fimc->lock); mutex_lock(&fimc->lock);
set_frame_bounds(ff, mf->width, mf->height); set_frame_bounds(ff, mf->width, mf->height);
fimc->vid_cap.mf = *mf;
ff->fmt = ffmt; ff->fmt = ffmt;
/* Reset the crop rectangle if required. */ /* Reset the crop rectangle if required. */
...@@ -1375,7 +1379,7 @@ static void fimc_destroy_capture_subdev(struct fimc_dev *fimc) ...@@ -1375,7 +1379,7 @@ static void fimc_destroy_capture_subdev(struct fimc_dev *fimc)
media_entity_cleanup(&sd->entity); media_entity_cleanup(&sd->entity);
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
kfree(sd); kfree(sd);
sd = NULL; fimc->vid_cap.subdev = NULL;
} }
/* Set default format at the sensor and host interface */ /* Set default format at the sensor and host interface */
......
...@@ -37,7 +37,7 @@ static char *fimc_clocks[MAX_FIMC_CLOCKS] = { ...@@ -37,7 +37,7 @@ static char *fimc_clocks[MAX_FIMC_CLOCKS] = {
static struct fimc_fmt fimc_formats[] = { static struct fimc_fmt fimc_formats[] = {
{ {
.name = "RGB565", .name = "RGB565",
.fourcc = V4L2_PIX_FMT_RGB565X, .fourcc = V4L2_PIX_FMT_RGB565,
.depth = { 16 }, .depth = { 16 },
.color = S5P_FIMC_RGB565, .color = S5P_FIMC_RGB565,
.memplanes = 1, .memplanes = 1,
...@@ -1038,12 +1038,11 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f) ...@@ -1038,12 +1038,11 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f)
mod_x = 6; /* 64 x 32 pixels tile */ mod_x = 6; /* 64 x 32 pixels tile */
mod_y = 5; mod_y = 5;
} else { } else {
if (fimc->id == 1 && variant->pix_hoff) if (variant->min_vsize_align == 1)
mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1; mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1;
else else
mod_y = mod_x; mod_y = ffs(variant->min_vsize_align) - 1;
} }
dbg("mod_x: %d, mod_y: %d, max_w: %d", mod_x, mod_y, max_w);
v4l_bound_align_image(&pix->width, 16, max_w, mod_x, v4l_bound_align_image(&pix->width, 16, max_w, mod_x,
&pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0); &pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0);
...@@ -1226,10 +1225,10 @@ static int fimc_m2m_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr) ...@@ -1226,10 +1225,10 @@ static int fimc_m2m_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr)
fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize; fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize;
/* Get pixel alignment constraints. */ /* Get pixel alignment constraints. */
if (fimc->id == 1 && fimc->variant->pix_hoff) if (fimc->variant->min_vsize_align == 1)
halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1; halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1;
else else
halign = ffs(min_size) - 1; halign = ffs(fimc->variant->min_vsize_align) - 1;
for (i = 0; i < f->fmt->colplanes; i++) for (i = 0; i < f->fmt->colplanes; i++)
depth += f->fmt->depth[i]; depth += f->fmt->depth[i];
...@@ -1615,7 +1614,6 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1615,7 +1614,6 @@ static int fimc_probe(struct platform_device *pdev)
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
fimc->pdata = pdata; fimc->pdata = pdata;
set_bit(ST_LPM, &fimc->state);
init_waitqueue_head(&fimc->irq_queue); init_waitqueue_head(&fimc->irq_queue);
spin_lock_init(&fimc->slock); spin_lock_init(&fimc->slock);
...@@ -1707,8 +1705,6 @@ static int fimc_runtime_resume(struct device *dev) ...@@ -1707,8 +1705,6 @@ static int fimc_runtime_resume(struct device *dev)
/* Enable clocks and perform basic initalization */ /* Enable clocks and perform basic initalization */
clk_enable(fimc->clock[CLK_GATE]); clk_enable(fimc->clock[CLK_GATE]);
fimc_hw_reset(fimc); fimc_hw_reset(fimc);
if (fimc->variant->out_buf_count > 4)
fimc_hw_set_dma_seq(fimc, 0xF);
/* Resume the capture or mem-to-mem device */ /* Resume the capture or mem-to-mem device */
if (fimc_capture_busy(fimc)) if (fimc_capture_busy(fimc))
...@@ -1750,8 +1746,6 @@ static int fimc_resume(struct device *dev) ...@@ -1750,8 +1746,6 @@ static int fimc_resume(struct device *dev)
return 0; return 0;
} }
fimc_hw_reset(fimc); fimc_hw_reset(fimc);
if (fimc->variant->out_buf_count > 4)
fimc_hw_set_dma_seq(fimc, 0xF);
spin_unlock_irqrestore(&fimc->slock, flags); spin_unlock_irqrestore(&fimc->slock, flags);
if (fimc_capture_busy(fimc)) if (fimc_capture_busy(fimc))
...@@ -1780,7 +1774,6 @@ static int __devexit fimc_remove(struct platform_device *pdev) ...@@ -1780,7 +1774,6 @@ static int __devexit fimc_remove(struct platform_device *pdev)
struct fimc_dev *fimc = platform_get_drvdata(pdev); struct fimc_dev *fimc = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
fimc_runtime_suspend(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev); pm_runtime_set_suspended(&pdev->dev);
vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx); vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
...@@ -1840,6 +1833,7 @@ static struct samsung_fimc_variant fimc0_variant_s5p = { ...@@ -1840,6 +1833,7 @@ static struct samsung_fimc_variant fimc0_variant_s5p = {
.min_inp_pixsize = 16, .min_inp_pixsize = 16,
.min_out_pixsize = 16, .min_out_pixsize = 16,
.hor_offs_align = 8, .hor_offs_align = 8,
.min_vsize_align = 16,
.out_buf_count = 4, .out_buf_count = 4,
.pix_limit = &s5p_pix_limit[0], .pix_limit = &s5p_pix_limit[0],
}; };
...@@ -1849,6 +1843,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = { ...@@ -1849,6 +1843,7 @@ static struct samsung_fimc_variant fimc2_variant_s5p = {
.min_inp_pixsize = 16, .min_inp_pixsize = 16,
.min_out_pixsize = 16, .min_out_pixsize = 16,
.hor_offs_align = 8, .hor_offs_align = 8,
.min_vsize_align = 16,
.out_buf_count = 4, .out_buf_count = 4,
.pix_limit = &s5p_pix_limit[1], .pix_limit = &s5p_pix_limit[1],
}; };
...@@ -1861,6 +1856,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv210 = { ...@@ -1861,6 +1856,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv210 = {
.min_inp_pixsize = 16, .min_inp_pixsize = 16,
.min_out_pixsize = 16, .min_out_pixsize = 16,
.hor_offs_align = 8, .hor_offs_align = 8,
.min_vsize_align = 16,
.out_buf_count = 4, .out_buf_count = 4,
.pix_limit = &s5p_pix_limit[1], .pix_limit = &s5p_pix_limit[1],
}; };
...@@ -1874,6 +1870,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 = { ...@@ -1874,6 +1870,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 = {
.min_inp_pixsize = 16, .min_inp_pixsize = 16,
.min_out_pixsize = 16, .min_out_pixsize = 16,
.hor_offs_align = 1, .hor_offs_align = 1,
.min_vsize_align = 1,
.out_buf_count = 4, .out_buf_count = 4,
.pix_limit = &s5p_pix_limit[2], .pix_limit = &s5p_pix_limit[2],
}; };
...@@ -1884,6 +1881,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = { ...@@ -1884,6 +1881,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = {
.min_inp_pixsize = 16, .min_inp_pixsize = 16,
.min_out_pixsize = 16, .min_out_pixsize = 16,
.hor_offs_align = 8, .hor_offs_align = 8,
.min_vsize_align = 16,
.out_buf_count = 4, .out_buf_count = 4,
.pix_limit = &s5p_pix_limit[2], .pix_limit = &s5p_pix_limit[2],
}; };
...@@ -1898,6 +1896,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 = { ...@@ -1898,6 +1896,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 = {
.min_inp_pixsize = 16, .min_inp_pixsize = 16,
.min_out_pixsize = 16, .min_out_pixsize = 16,
.hor_offs_align = 2, .hor_offs_align = 2,
.min_vsize_align = 1,
.out_buf_count = 32, .out_buf_count = 32,
.pix_limit = &s5p_pix_limit[1], .pix_limit = &s5p_pix_limit[1],
}; };
...@@ -1910,6 +1909,7 @@ static struct samsung_fimc_variant fimc3_variant_exynos4 = { ...@@ -1910,6 +1909,7 @@ static struct samsung_fimc_variant fimc3_variant_exynos4 = {
.min_inp_pixsize = 16, .min_inp_pixsize = 16,
.min_out_pixsize = 16, .min_out_pixsize = 16,
.hor_offs_align = 2, .hor_offs_align = 2,
.min_vsize_align = 1,
.out_buf_count = 32, .out_buf_count = 32,
.pix_limit = &s5p_pix_limit[3], .pix_limit = &s5p_pix_limit[3],
}; };
......
...@@ -377,6 +377,7 @@ struct fimc_pix_limit { ...@@ -377,6 +377,7 @@ struct fimc_pix_limit {
* @min_inp_pixsize: minimum input pixel size * @min_inp_pixsize: minimum input pixel size
* @min_out_pixsize: minimum output pixel size * @min_out_pixsize: minimum output pixel size
* @hor_offs_align: horizontal pixel offset aligment * @hor_offs_align: horizontal pixel offset aligment
* @min_vsize_align: minimum vertical pixel size alignment
* @out_buf_count: the number of buffers in output DMA sequence * @out_buf_count: the number of buffers in output DMA sequence
*/ */
struct samsung_fimc_variant { struct samsung_fimc_variant {
...@@ -390,6 +391,7 @@ struct samsung_fimc_variant { ...@@ -390,6 +391,7 @@ struct samsung_fimc_variant {
u16 min_inp_pixsize; u16 min_inp_pixsize;
u16 min_out_pixsize; u16 min_out_pixsize;
u16 hor_offs_align; u16 hor_offs_align;
u16 min_vsize_align;
u16 out_buf_count; u16 out_buf_count;
}; };
......
...@@ -220,6 +220,7 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd, ...@@ -220,6 +220,7 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,
sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter, sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter,
s_info->pdata->board_info, NULL); s_info->pdata->board_info, NULL);
if (IS_ERR_OR_NULL(sd)) { if (IS_ERR_OR_NULL(sd)) {
i2c_put_adapter(adapter);
v4l2_err(&fmd->v4l2_dev, "Failed to acquire subdev\n"); v4l2_err(&fmd->v4l2_dev, "Failed to acquire subdev\n");
return NULL; return NULL;
} }
...@@ -234,12 +235,15 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd, ...@@ -234,12 +235,15 @@ static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,
static void fimc_md_unregister_sensor(struct v4l2_subdev *sd) static void fimc_md_unregister_sensor(struct v4l2_subdev *sd)
{ {
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
struct i2c_adapter *adapter;
if (!client) if (!client)
return; return;
v4l2_device_unregister_subdev(sd); v4l2_device_unregister_subdev(sd);
adapter = client->adapter;
i2c_unregister_device(client); i2c_unregister_device(client);
i2c_put_adapter(client->adapter); if (adapter)
i2c_put_adapter(adapter);
} }
static int fimc_md_register_sensor_entities(struct fimc_md *fmd) static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
...@@ -381,20 +385,28 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd) ...@@ -381,20 +385,28 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd)
static int fimc_md_register_video_nodes(struct fimc_md *fmd) static int fimc_md_register_video_nodes(struct fimc_md *fmd)
{ {
struct video_device *vdev;
int i, ret = 0; int i, ret = 0;
for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) { for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) {
if (!fmd->fimc[i]) if (!fmd->fimc[i])
continue; continue;
if (fmd->fimc[i]->m2m.vfd) vdev = fmd->fimc[i]->m2m.vfd;
ret = video_register_device(fmd->fimc[i]->m2m.vfd, if (vdev) {
VFL_TYPE_GRABBER, -1); ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
if (ret) if (ret)
break; break;
if (fmd->fimc[i]->vid_cap.vfd) v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n",
ret = video_register_device(fmd->fimc[i]->vid_cap.vfd, vdev->name, video_device_node_name(vdev));
VFL_TYPE_GRABBER, -1); }
vdev = fmd->fimc[i]->vid_cap.vfd;
if (vdev == NULL)
continue;
ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s\n",
vdev->name, video_device_node_name(vdev));
} }
return ret; return ret;
...@@ -502,7 +514,7 @@ static int fimc_md_create_links(struct fimc_md *fmd) ...@@ -502,7 +514,7 @@ static int fimc_md_create_links(struct fimc_md *fmd)
if (WARN(csis == NULL, if (WARN(csis == NULL,
"MIPI-CSI interface specified " "MIPI-CSI interface specified "
"but s5p-csis module is not loaded!\n")) "but s5p-csis module is not loaded!\n"))
continue; return -EINVAL;
ret = media_entity_create_link(&sensor->entity, 0, ret = media_entity_create_link(&sensor->entity, 0,
&csis->entity, CSIS_PAD_SINK, &csis->entity, CSIS_PAD_SINK,
...@@ -742,9 +754,6 @@ static int __devinit fimc_md_probe(struct platform_device *pdev) ...@@ -742,9 +754,6 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
struct fimc_md *fmd; struct fimc_md *fmd;
int ret; int ret;
if (WARN(!pdev->dev.platform_data, "Platform data not specified!\n"))
return -EINVAL;
fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL); fmd = kzalloc(sizeof(struct fimc_md), GFP_KERNEL);
if (!fmd) if (!fmd)
return -ENOMEM; return -ENOMEM;
...@@ -782,9 +791,11 @@ static int __devinit fimc_md_probe(struct platform_device *pdev) ...@@ -782,9 +791,11 @@ static int __devinit fimc_md_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err3; goto err3;
ret = fimc_md_register_sensor_entities(fmd); if (pdev->dev.platform_data) {
if (ret) ret = fimc_md_register_sensor_entities(fmd);
goto err3; if (ret)
goto err3;
}
ret = fimc_md_create_links(fmd); ret = fimc_md_create_links(fmd);
if (ret) if (ret)
goto err3; goto err3;
......
...@@ -35,6 +35,9 @@ void fimc_hw_reset(struct fimc_dev *dev) ...@@ -35,6 +35,9 @@ void fimc_hw_reset(struct fimc_dev *dev)
cfg = readl(dev->regs + S5P_CIGCTRL); cfg = readl(dev->regs + S5P_CIGCTRL);
cfg &= ~S5P_CIGCTRL_SWRST; cfg &= ~S5P_CIGCTRL_SWRST;
writel(cfg, dev->regs + S5P_CIGCTRL); writel(cfg, dev->regs + S5P_CIGCTRL);
if (dev->variant->out_buf_count > 4)
fimc_hw_set_dma_seq(dev, 0xF);
} }
static u32 fimc_hw_get_in_flip(struct fimc_ctx *ctx) static u32 fimc_hw_get_in_flip(struct fimc_ctx *ctx)
...@@ -251,7 +254,14 @@ static void fimc_hw_set_scaler(struct fimc_ctx *ctx) ...@@ -251,7 +254,14 @@ static void fimc_hw_set_scaler(struct fimc_ctx *ctx)
struct fimc_scaler *sc = &ctx->scaler; struct fimc_scaler *sc = &ctx->scaler;
struct fimc_frame *src_frame = &ctx->s_frame; struct fimc_frame *src_frame = &ctx->s_frame;
struct fimc_frame *dst_frame = &ctx->d_frame; struct fimc_frame *dst_frame = &ctx->d_frame;
u32 cfg = 0;
u32 cfg = readl(dev->regs + S5P_CISCCTRL);
cfg &= ~(S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE |
S5P_CISCCTRL_SCALEUP_H | S5P_CISCCTRL_SCALEUP_V |
S5P_CISCCTRL_SCALERBYPASS | S5P_CISCCTRL_ONE2ONE |
S5P_CISCCTRL_INRGB_FMT_MASK | S5P_CISCCTRL_OUTRGB_FMT_MASK |
S5P_CISCCTRL_INTERLACE | S5P_CISCCTRL_RGB_EXT);
if (!(ctx->flags & FIMC_COLOR_RANGE_NARROW)) if (!(ctx->flags & FIMC_COLOR_RANGE_NARROW))
cfg |= (S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE); cfg |= (S5P_CISCCTRL_CSCR2Y_WIDE | S5P_CISCCTRL_CSCY2R_WIDE);
...@@ -308,9 +318,9 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx) ...@@ -308,9 +318,9 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx)
fimc_hw_set_scaler(ctx); fimc_hw_set_scaler(ctx);
cfg = readl(dev->regs + S5P_CISCCTRL); cfg = readl(dev->regs + S5P_CISCCTRL);
cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
if (variant->has_mainscaler_ext) { if (variant->has_mainscaler_ext) {
cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio); cfg |= S5P_CISCCTRL_MHRATIO_EXT(sc->main_hratio);
cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio); cfg |= S5P_CISCCTRL_MVRATIO_EXT(sc->main_vratio);
writel(cfg, dev->regs + S5P_CISCCTRL); writel(cfg, dev->regs + S5P_CISCCTRL);
...@@ -323,7 +333,6 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx) ...@@ -323,7 +333,6 @@ void fimc_hw_set_mainscaler(struct fimc_ctx *ctx)
cfg |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio); cfg |= S5P_CIEXTEN_MVRATIO_EXT(sc->main_vratio);
writel(cfg, dev->regs + S5P_CIEXTEN); writel(cfg, dev->regs + S5P_CIEXTEN);
} else { } else {
cfg &= ~(S5P_CISCCTRL_MHRATIO_MASK | S5P_CISCCTRL_MVRATIO_MASK);
cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio); cfg |= S5P_CISCCTRL_MHRATIO(sc->main_hratio);
cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio); cfg |= S5P_CISCCTRL_MVRATIO(sc->main_vratio);
writel(cfg, dev->regs + S5P_CISCCTRL); writel(cfg, dev->regs + S5P_CISCCTRL);
......
...@@ -61,7 +61,7 @@ static struct s5p_mfc_fmt formats[] = { ...@@ -61,7 +61,7 @@ static struct s5p_mfc_fmt formats[] = {
.num_planes = 1, .num_planes = 1,
}, },
{ {
.name = "H264 Encoded Stream", .name = "H263 Encoded Stream",
.fourcc = V4L2_PIX_FMT_H263, .fourcc = V4L2_PIX_FMT_H263,
.codec_mode = S5P_FIMV_CODEC_H263_ENC, .codec_mode = S5P_FIMV_CODEC_H263_ENC,
.type = MFC_FMT_ENC, .type = MFC_FMT_ENC,
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <media/v4l2-ioctl.h> #include <media/v4l2-ioctl.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <media/videobuf2-dma-contig.h> #include <media/videobuf2-dma-contig.h>
......
...@@ -566,8 +566,10 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) ...@@ -566,8 +566,10 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
ret = sh_mobile_ceu_soft_reset(pcdev); ret = sh_mobile_ceu_soft_reset(pcdev);
csi2_sd = find_csi2(pcdev); csi2_sd = find_csi2(pcdev);
if (csi2_sd) if (csi2_sd) {
csi2_sd->grp_id = (long)icd; csi2_sd->grp_id = soc_camera_grp_id(icd);
v4l2_set_subdev_hostdata(csi2_sd, icd);
}
ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); ret = v4l2_subdev_call(csi2_sd, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) { if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) {
...@@ -768,7 +770,7 @@ static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev, ...@@ -768,7 +770,7 @@ static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev,
{ {
if (pcdev->csi2_pdev) { if (pcdev->csi2_pdev) {
struct v4l2_subdev *csi2_sd = find_csi2(pcdev); struct v4l2_subdev *csi2_sd = find_csi2(pcdev);
if (csi2_sd && csi2_sd->grp_id == (u32)icd) if (csi2_sd && csi2_sd->grp_id == soc_camera_grp_id(icd))
return csi2_sd; return csi2_sd;
} }
...@@ -1089,8 +1091,9 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int ...@@ -1089,8 +1091,9 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
/* Try 2560x1920, 1280x960, 640x480, 320x240 */ /* Try 2560x1920, 1280x960, 640x480, 320x240 */
mf.width = 2560 >> shift; mf.width = 2560 >> shift;
mf.height = 1920 >> shift; mf.height = 1920 >> shift;
ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, ret = v4l2_device_call_until_err(sd->v4l2_dev,
s_mbus_fmt, &mf); soc_camera_grp_id(icd), video,
s_mbus_fmt, &mf);
if (ret < 0) if (ret < 0)
return ret; return ret;
shift++; shift++;
...@@ -1389,7 +1392,8 @@ static int client_s_fmt(struct soc_camera_device *icd, ...@@ -1389,7 +1392,8 @@ static int client_s_fmt(struct soc_camera_device *icd,
bool ceu_1to1; bool ceu_1to1;
int ret; int ret;
ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, ret = v4l2_device_call_until_err(sd->v4l2_dev,
soc_camera_grp_id(icd), video,
s_mbus_fmt, mf); s_mbus_fmt, mf);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1426,8 +1430,9 @@ static int client_s_fmt(struct soc_camera_device *icd, ...@@ -1426,8 +1430,9 @@ static int client_s_fmt(struct soc_camera_device *icd,
tmp_h = min(2 * tmp_h, max_height); tmp_h = min(2 * tmp_h, max_height);
mf->width = tmp_w; mf->width = tmp_w;
mf->height = tmp_h; mf->height = tmp_h;
ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, ret = v4l2_device_call_until_err(sd->v4l2_dev,
s_mbus_fmt, mf); soc_camera_grp_id(icd), video,
s_mbus_fmt, mf);
dev_geo(dev, "Camera scaled to %ux%u\n", dev_geo(dev, "Camera scaled to %ux%u\n",
mf->width, mf->height); mf->width, mf->height);
if (ret < 0) { if (ret < 0) {
...@@ -1580,8 +1585,9 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, ...@@ -1580,8 +1585,9 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
} }
if (interm_width < icd->user_width || interm_height < icd->user_height) { if (interm_width < icd->user_width || interm_height < icd->user_height) {
ret = v4l2_device_call_until_err(sd->v4l2_dev, (int)icd, video, ret = v4l2_device_call_until_err(sd->v4l2_dev,
s_mbus_fmt, &mf); soc_camera_grp_id(icd), video,
s_mbus_fmt, &mf);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1867,7 +1873,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, ...@@ -1867,7 +1873,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
mf.code = xlate->code; mf.code = xlate->code;
mf.colorspace = pix->colorspace; mf.colorspace = pix->colorspace;
ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, try_mbus_fmt, &mf); ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd),
video, try_mbus_fmt, &mf);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1891,8 +1898,9 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, ...@@ -1891,8 +1898,9 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
*/ */
mf.width = 2560; mf.width = 2560;
mf.height = 1920; mf.height = 1920;
ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, ret = v4l2_device_call_until_err(sd->v4l2_dev,
try_mbus_fmt, &mf); soc_camera_grp_id(icd), video,
try_mbus_fmt, &mf);
if (ret < 0) { if (ret < 0) {
/* Shouldn't actually happen... */ /* Shouldn't actually happen... */
dev_err(icd->parent, dev_err(icd->parent,
......
...@@ -143,7 +143,7 @@ static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd, ...@@ -143,7 +143,7 @@ static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd,
const struct v4l2_mbus_config *cfg) const struct v4l2_mbus_config *cfg)
{ {
struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev);
struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd);
struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2, struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2,
.flags = priv->mipi_flags}; .flags = priv->mipi_flags};
...@@ -202,7 +202,7 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv) ...@@ -202,7 +202,7 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv)
static int sh_csi2_client_connect(struct sh_csi2 *priv) static int sh_csi2_client_connect(struct sh_csi2 *priv)
{ {
struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data;
struct soc_camera_device *icd = (struct soc_camera_device *)priv->subdev.grp_id; struct soc_camera_device *icd = v4l2_get_subdev_hostdata(&priv->subdev);
struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd);
struct device *dev = v4l2_get_subdevdata(&priv->subdev); struct device *dev = v4l2_get_subdevdata(&priv->subdev);
struct v4l2_mbus_config cfg; struct v4l2_mbus_config cfg;
......
...@@ -1103,7 +1103,8 @@ static int soc_camera_probe(struct soc_camera_device *icd) ...@@ -1103,7 +1103,8 @@ static int soc_camera_probe(struct soc_camera_device *icd)
} }
sd = soc_camera_to_subdev(icd); sd = soc_camera_to_subdev(icd);
sd->grp_id = (long)icd; sd->grp_id = soc_camera_grp_id(icd);
v4l2_set_subdev_hostdata(sd, icd);
if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler)) if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler))
goto ectrl; goto ectrl;
......
...@@ -254,7 +254,7 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl, ...@@ -254,7 +254,7 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
{ {
struct v4l2_subdev *sd = i2c_get_clientdata(client); struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
return icd ? icd->vdev : NULL; return icd ? icd->vdev : NULL;
} }
...@@ -279,6 +279,11 @@ static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobu ...@@ -279,6 +279,11 @@ static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobu
return container_of(vq, struct soc_camera_device, vb_vidq); return container_of(vq, struct soc_camera_device, vb_vidq);
} }
static inline u32 soc_camera_grp_id(const struct soc_camera_device *icd)
{
return (icd->iface << 8) | (icd->devnum + 1);
}
void soc_camera_lock(struct vb2_queue *vq); void soc_camera_lock(struct vb2_queue *vq);
void soc_camera_unlock(struct vb2_queue *vq); void soc_camera_unlock(struct vb2_queue *vq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册