Commit 8488e408 authored by Linus Torvalds's avatar 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:
 - Some regression fixes at the audio part for devices with
   cx23885/cx25840
 - A DMA corruption fix at cx231xx
 - two fixes at the winbond IR driver
 - Several fixes for the EXYNOS media driver (s5p)
 - two fixes at the OMAP3 preview driver
 - one fix at the dvb core failure path
 - an include missing (slab.h) at smiapp-core causing compilation
   breakage
 - em28xx was not loading the IR driver driver anymore.

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (31 commits)
  [media] Revert "[media] V4L: JPEG class documentation corrections"
  [media] s5p-fimc: Add missing FIMC-LITE file operations locking
  [media] omap3isp: preview: Fix contrast and brightness handling
  [media] omap3isp: preview: Fix output size computation depending on input format
  [media] winbond-cir: Initialise timeout, driver_type and allowed_protos
  [media] winbond-cir: Fix txandrx module info
  [media] cx23885: Silence unknown command warnings
  [media] cx23885: add support for HVR-1255 analog (cx23888 variant)
  [media] cx23885: make analog support work for HVR_1250 (cx23885 variant)
  [media] cx25840: fix vsrc/hsrc usage on cx23888 designs
  [media] cx25840: fix regression in HVR-1800 analog audio
  [media] cx25840: fix regression in analog support hue/saturation controls
  [media] cx25840: fix regression in HVR-1800 analog support
  [media] s5p-mfc: Fixed setup of custom controls in decoder and encoder
  [media] cx231xx: don't DMA to random addresses
  [media] em28xx: fix em28xx-rc load
  [media] dvb-core: Release semaphore on error path dvb_register_device()
  [media] s5p-fimc: Stop media entity pipeline if fimc_pipeline_validate fails
  [media] s5p-fimc: Fix compiler warning in fimc-lite.c
  [media] s5p-fimc: media_entity_pipeline_start() may fail
  ...
parents 2c913900 ec3ed85f
...@@ -3988,7 +3988,7 @@ interface and may change in the future.</para> ...@@ -3988,7 +3988,7 @@ interface and may change in the future.</para>
from RGB to Y'CbCr color space. from RGB to Y'CbCr color space.
</entry> </entry>
</row> </row>
<row id = "v4l2-jpeg-chroma-subsampling"> <row>
<entrytbl spanname="descr" cols="2"> <entrytbl spanname="descr" cols="2">
<tbody valign="top"> <tbody valign="top">
<row> <row>
......
...@@ -284,13 +284,6 @@ These controls are described in <xref ...@@ -284,13 +284,6 @@ These controls are described in <xref
processing controls. These controls are described in <xref processing controls. These controls are described in <xref
linkend="image-process-controls" />.</entry> linkend="image-process-controls" />.</entry>
</row> </row>
<row>
<entry><constant>V4L2_CTRL_CLASS_JPEG</constant></entry>
<entry>0x9d0000</entry>
<entry>The class containing JPEG compression controls.
These controls are described in <xref
linkend="jpeg-controls" />.</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
......
...@@ -243,6 +243,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, ...@@ -243,6 +243,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
if (minor == MAX_DVB_MINORS) { if (minor == MAX_DVB_MINORS) {
kfree(dvbdevfops); kfree(dvbdevfops);
kfree(dvbdev); kfree(dvbdev);
up_write(&minor_rwsem);
mutex_unlock(&dvbdev_register_lock); mutex_unlock(&dvbdev_register_lock);
return -EINVAL; return -EINVAL;
} }
......
...@@ -232,7 +232,7 @@ MODULE_PARM_DESC(invert, "Invert the signal from the IR receiver"); ...@@ -232,7 +232,7 @@ MODULE_PARM_DESC(invert, "Invert the signal from the IR receiver");
static bool txandrx; /* default = 0 */ static bool txandrx; /* default = 0 */
module_param(txandrx, bool, 0444); module_param(txandrx, bool, 0444);
MODULE_PARM_DESC(invert, "Allow simultaneous TX and RX"); MODULE_PARM_DESC(txandrx, "Allow simultaneous TX and RX");
static unsigned int wake_sc = 0x800F040C; static unsigned int wake_sc = 0x800F040C;
module_param(wake_sc, uint, 0644); module_param(wake_sc, uint, 0644);
...@@ -1032,6 +1032,8 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) ...@@ -1032,6 +1032,8 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
data->dev->tx_ir = wbcir_tx; data->dev->tx_ir = wbcir_tx;
data->dev->priv = data; data->dev->priv = data;
data->dev->dev.parent = &device->dev; data->dev->dev.parent = &device->dev;
data->dev->timeout = MS_TO_NS(100);
data->dev->allowed_protos = RC_TYPE_ALL;
if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
......
...@@ -307,7 +307,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) ...@@ -307,7 +307,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
urb->context = dev; urb->context = dev;
urb->pipe = usb_rcvisocpipe(dev->udev, urb->pipe = usb_rcvisocpipe(dev->udev,
dev->adev.end_point_addr); dev->adev.end_point_addr);
urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; urb->transfer_flags = URB_ISO_ASAP;
urb->transfer_buffer = dev->adev.transfer_buffer[i]; urb->transfer_buffer = dev->adev.transfer_buffer[i];
urb->interval = 1; urb->interval = 1;
urb->complete = cx231xx_audio_isocirq; urb->complete = cx231xx_audio_isocirq;
...@@ -368,7 +368,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev) ...@@ -368,7 +368,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)
urb->context = dev; urb->context = dev;
urb->pipe = usb_rcvbulkpipe(dev->udev, urb->pipe = usb_rcvbulkpipe(dev->udev,
dev->adev.end_point_addr); dev->adev.end_point_addr);
urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; urb->transfer_flags = 0;
urb->transfer_buffer = dev->adev.transfer_buffer[i]; urb->transfer_buffer = dev->adev.transfer_buffer[i];
urb->complete = cx231xx_audio_bulkirq; urb->complete = cx231xx_audio_bulkirq;
urb->transfer_buffer_length = sb_size; urb->transfer_buffer_length = sb_size;
......
...@@ -448,7 +448,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, ...@@ -448,7 +448,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
return -ENOMEM; return -ENOMEM;
} }
dev->vbi_mode.bulk_ctl.urb[i] = urb; dev->vbi_mode.bulk_ctl.urb[i] = urb;
urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; urb->transfer_flags = 0;
dev->vbi_mode.bulk_ctl.transfer_buffer[i] = dev->vbi_mode.bulk_ctl.transfer_buffer[i] =
kzalloc(sb_size, GFP_KERNEL); kzalloc(sb_size, GFP_KERNEL);
......
...@@ -127,22 +127,37 @@ struct cx23885_board cx23885_boards[] = { ...@@ -127,22 +127,37 @@ struct cx23885_board cx23885_boards[] = {
}, },
[CX23885_BOARD_HAUPPAUGE_HVR1250] = { [CX23885_BOARD_HAUPPAUGE_HVR1250] = {
.name = "Hauppauge WinTV-HVR1250", .name = "Hauppauge WinTV-HVR1250",
.porta = CX23885_ANALOG_VIDEO,
.portc = CX23885_MPEG_DVB, .portc = CX23885_MPEG_DVB,
#ifdef MT2131_NO_ANALOG_SUPPORT_YET
.tuner_type = TUNER_PHILIPS_TDA8290,
.tuner_addr = 0x42, /* 0x84 >> 1 */
.tuner_bus = 1,
#endif
.force_bff = 1,
.input = {{ .input = {{
#ifdef MT2131_NO_ANALOG_SUPPORT_YET
.type = CX23885_VMUX_TELEVISION, .type = CX23885_VMUX_TELEVISION,
.vmux = 0, .vmux = CX25840_VIN7_CH3 |
CX25840_VIN5_CH2 |
CX25840_VIN2_CH1,
.amux = CX25840_AUDIO8,
.gpio0 = 0xff00, .gpio0 = 0xff00,
}, { }, {
.type = CX23885_VMUX_DEBUG, #endif
.vmux = 0,
.gpio0 = 0xff01,
}, {
.type = CX23885_VMUX_COMPOSITE1, .type = CX23885_VMUX_COMPOSITE1,
.vmux = 1, .vmux = CX25840_VIN7_CH3 |
CX25840_VIN4_CH2 |
CX25840_VIN6_CH1,
.amux = CX25840_AUDIO7,
.gpio0 = 0xff02, .gpio0 = 0xff02,
}, { }, {
.type = CX23885_VMUX_SVIDEO, .type = CX23885_VMUX_SVIDEO,
.vmux = 2, .vmux = CX25840_VIN7_CH3 |
CX25840_VIN4_CH2 |
CX25840_VIN8_CH1 |
CX25840_SVIDEO_ON,
.amux = CX25840_AUDIO7,
.gpio0 = 0xff02, .gpio0 = 0xff02,
} }, } },
}, },
...@@ -267,7 +282,55 @@ struct cx23885_board cx23885_boards[] = { ...@@ -267,7 +282,55 @@ struct cx23885_board cx23885_boards[] = {
}, },
[CX23885_BOARD_HAUPPAUGE_HVR1255] = { [CX23885_BOARD_HAUPPAUGE_HVR1255] = {
.name = "Hauppauge WinTV-HVR1255", .name = "Hauppauge WinTV-HVR1255",
.porta = CX23885_ANALOG_VIDEO,
.portc = CX23885_MPEG_DVB,
.tuner_type = TUNER_ABSENT,
.tuner_addr = 0x42, /* 0x84 >> 1 */
.force_bff = 1,
.input = {{
.type = CX23885_VMUX_TELEVISION,
.vmux = CX25840_VIN7_CH3 |
CX25840_VIN5_CH2 |
CX25840_VIN2_CH1 |
CX25840_DIF_ON,
.amux = CX25840_AUDIO8,
}, {
.type = CX23885_VMUX_COMPOSITE1,
.vmux = CX25840_VIN7_CH3 |
CX25840_VIN4_CH2 |
CX25840_VIN6_CH1,
.amux = CX25840_AUDIO7,
}, {
.type = CX23885_VMUX_SVIDEO,
.vmux = CX25840_VIN7_CH3 |
CX25840_VIN4_CH2 |
CX25840_VIN8_CH1 |
CX25840_SVIDEO_ON,
.amux = CX25840_AUDIO7,
} },
},
[CX23885_BOARD_HAUPPAUGE_HVR1255_22111] = {
.name = "Hauppauge WinTV-HVR1255",
.porta = CX23885_ANALOG_VIDEO,
.portc = CX23885_MPEG_DVB, .portc = CX23885_MPEG_DVB,
.tuner_type = TUNER_ABSENT,
.tuner_addr = 0x42, /* 0x84 >> 1 */
.force_bff = 1,
.input = {{
.type = CX23885_VMUX_TELEVISION,
.vmux = CX25840_VIN7_CH3 |
CX25840_VIN5_CH2 |
CX25840_VIN2_CH1 |
CX25840_DIF_ON,
.amux = CX25840_AUDIO8,
}, {
.type = CX23885_VMUX_SVIDEO,
.vmux = CX25840_VIN7_CH3 |
CX25840_VIN4_CH2 |
CX25840_VIN8_CH1 |
CX25840_SVIDEO_ON,
.amux = CX25840_AUDIO7,
} },
}, },
[CX23885_BOARD_HAUPPAUGE_HVR1210] = { [CX23885_BOARD_HAUPPAUGE_HVR1210] = {
.name = "Hauppauge WinTV-HVR1210", .name = "Hauppauge WinTV-HVR1210",
...@@ -624,7 +687,7 @@ struct cx23885_subid cx23885_subids[] = { ...@@ -624,7 +687,7 @@ struct cx23885_subid cx23885_subids[] = {
}, { }, {
.subvendor = 0x0070, .subvendor = 0x0070,
.subdevice = 0x2259, .subdevice = 0x2259,
.card = CX23885_BOARD_HAUPPAUGE_HVR1255, .card = CX23885_BOARD_HAUPPAUGE_HVR1255_22111,
}, { }, {
.subvendor = 0x0070, .subvendor = 0x0070,
.subdevice = 0x2291, .subdevice = 0x2291,
...@@ -900,7 +963,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg) ...@@ -900,7 +963,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg)
struct cx23885_dev *dev = port->dev; struct cx23885_dev *dev = port->dev;
u32 bitmask = 0; u32 bitmask = 0;
if (command == XC2028_RESET_CLK) if ((command == XC2028_RESET_CLK) || (command == XC2028_I2C_FLUSH))
return 0; return 0;
if (command != 0) { if (command != 0) {
...@@ -1130,6 +1193,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) ...@@ -1130,6 +1193,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1270:
case CX23885_BOARD_HAUPPAUGE_HVR1275: case CX23885_BOARD_HAUPPAUGE_HVR1275:
case CX23885_BOARD_HAUPPAUGE_HVR1255: case CX23885_BOARD_HAUPPAUGE_HVR1255:
case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
case CX23885_BOARD_HAUPPAUGE_HVR1210: case CX23885_BOARD_HAUPPAUGE_HVR1210:
/* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */
/* GPIO-6 I2C Gate which can isolate the demod from the bus */ /* GPIO-6 I2C Gate which can isolate the demod from the bus */
...@@ -1267,6 +1331,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) ...@@ -1267,6 +1331,7 @@ int cx23885_ir_init(struct cx23885_dev *dev)
case CX23885_BOARD_HAUPPAUGE_HVR1400: case CX23885_BOARD_HAUPPAUGE_HVR1400:
case CX23885_BOARD_HAUPPAUGE_HVR1275: case CX23885_BOARD_HAUPPAUGE_HVR1275:
case CX23885_BOARD_HAUPPAUGE_HVR1255: case CX23885_BOARD_HAUPPAUGE_HVR1255:
case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
case CX23885_BOARD_HAUPPAUGE_HVR1210: case CX23885_BOARD_HAUPPAUGE_HVR1210:
/* FIXME: Implement me */ /* FIXME: Implement me */
break; break;
...@@ -1424,6 +1489,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) ...@@ -1424,6 +1489,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1270:
case CX23885_BOARD_HAUPPAUGE_HVR1275: case CX23885_BOARD_HAUPPAUGE_HVR1275:
case CX23885_BOARD_HAUPPAUGE_HVR1255: case CX23885_BOARD_HAUPPAUGE_HVR1255:
case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
case CX23885_BOARD_HAUPPAUGE_HVR1210: case CX23885_BOARD_HAUPPAUGE_HVR1210:
case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1850:
case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_HAUPPAUGE_HVR1290:
...@@ -1511,6 +1577,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) ...@@ -1511,6 +1577,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1270:
case CX23885_BOARD_HAUPPAUGE_HVR1275: case CX23885_BOARD_HAUPPAUGE_HVR1275:
case CX23885_BOARD_HAUPPAUGE_HVR1255: case CX23885_BOARD_HAUPPAUGE_HVR1255:
case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
case CX23885_BOARD_HAUPPAUGE_HVR1210: case CX23885_BOARD_HAUPPAUGE_HVR1210:
case CX23885_BOARD_COMPRO_VIDEOMATE_E800: case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
case CX23885_BOARD_HAUPPAUGE_HVR1290: case CX23885_BOARD_HAUPPAUGE_HVR1290:
...@@ -1526,10 +1593,10 @@ void cx23885_card_setup(struct cx23885_dev *dev) ...@@ -1526,10 +1593,10 @@ void cx23885_card_setup(struct cx23885_dev *dev)
*/ */
switch (dev->board) { switch (dev->board) {
case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_TEVII_S470:
case CX23885_BOARD_HAUPPAUGE_HVR1250:
/* Currently only enabled for the integrated IR controller */ /* Currently only enabled for the integrated IR controller */
if (!enable_885_ir) if (!enable_885_ir)
break; break;
case CX23885_BOARD_HAUPPAUGE_HVR1250:
case CX23885_BOARD_HAUPPAUGE_HVR1800: case CX23885_BOARD_HAUPPAUGE_HVR1800:
case CX23885_BOARD_HAUPPAUGE_HVR1800lp: case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
case CX23885_BOARD_HAUPPAUGE_HVR1700: case CX23885_BOARD_HAUPPAUGE_HVR1700:
...@@ -1539,6 +1606,8 @@ void cx23885_card_setup(struct cx23885_dev *dev) ...@@ -1539,6 +1606,8 @@ void cx23885_card_setup(struct cx23885_dev *dev)
case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
case CX23885_BOARD_COMPRO_VIDEOMATE_E800: case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
case CX23885_BOARD_HAUPPAUGE_HVR1255:
case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
case CX23885_BOARD_HAUPPAUGE_HVR1270: case CX23885_BOARD_HAUPPAUGE_HVR1270:
case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1850:
case CX23885_BOARD_MYGICA_X8506: case CX23885_BOARD_MYGICA_X8506:
......
...@@ -712,6 +712,7 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -712,6 +712,7 @@ static int dvb_register(struct cx23885_tsport *port)
} }
break; break;
case CX23885_BOARD_HAUPPAUGE_HVR1255: case CX23885_BOARD_HAUPPAUGE_HVR1255:
case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
i2c_bus = &dev->i2c_bus[0]; i2c_bus = &dev->i2c_bus[0];
fe0->dvb.frontend = dvb_attach(s5h1411_attach, fe0->dvb.frontend = dvb_attach(s5h1411_attach,
&hcw_s5h1411_config, &hcw_s5h1411_config,
...@@ -721,6 +722,11 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -721,6 +722,11 @@ static int dvb_register(struct cx23885_tsport *port)
0x60, &dev->i2c_bus[1].i2c_adap, 0x60, &dev->i2c_bus[1].i2c_adap,
&hauppauge_tda18271_config); &hauppauge_tda18271_config);
} }
tda18271_attach(&dev->ts1.analog_fe,
0x60, &dev->i2c_bus[1].i2c_adap,
&hauppauge_tda18271_config);
break; break;
case CX23885_BOARD_HAUPPAUGE_HVR1800: case CX23885_BOARD_HAUPPAUGE_HVR1800:
i2c_bus = &dev->i2c_bus[0]; i2c_bus = &dev->i2c_bus[0];
......
...@@ -505,6 +505,9 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) ...@@ -505,6 +505,9 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) ||
(dev->board == CX23885_BOARD_MPX885) || (dev->board == CX23885_BOARD_MPX885) ||
(dev->board == CX23885_BOARD_HAUPPAUGE_HVR1250) ||
(dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) ||
(dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111) ||
(dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850)) { (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850)) {
/* Configure audio routing */ /* Configure audio routing */
v4l2_subdev_call(dev->sd_cx25840, audio, s_routing, v4l2_subdev_call(dev->sd_cx25840, audio, s_routing,
...@@ -1578,7 +1581,9 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev, ...@@ -1578,7 +1581,9 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev,
fe = vfe->dvb.frontend; fe = vfe->dvb.frontend;
if (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) ||
(dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) ||
(dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111))
fe = &dev->ts1.analog_fe; fe = &dev->ts1.analog_fe;
if (fe && fe->ops.tuner_ops.set_analog_params) { if (fe && fe->ops.tuner_ops.set_analog_params) {
...@@ -1608,6 +1613,8 @@ int cx23885_set_frequency(struct file *file, void *priv, ...@@ -1608,6 +1613,8 @@ int cx23885_set_frequency(struct file *file, void *priv,
int ret; int ret;
switch (dev->board) { switch (dev->board) {
case CX23885_BOARD_HAUPPAUGE_HVR1255:
case CX23885_BOARD_HAUPPAUGE_HVR1255_22111:
case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1850:
ret = cx23885_set_freq_via_ops(dev, f); ret = cx23885_set_freq_via_ops(dev, f);
break; break;
......
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
#define CX23885_BOARD_MYGICA_X8507 33 #define CX23885_BOARD_MYGICA_X8507 33
#define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34 #define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34
#define CX23885_BOARD_TEVII_S471 35 #define CX23885_BOARD_TEVII_S471 35
#define CX23885_BOARD_HAUPPAUGE_HVR1255_22111 36
#define GPIO_0 0x00000001 #define GPIO_0 0x00000001
#define GPIO_1 0x00000002 #define GPIO_1 0x00000002
......
...@@ -84,7 +84,7 @@ MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]"); ...@@ -84,7 +84,7 @@ MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static void cx23885_std_setup(struct i2c_client *client); static void cx23888_std_setup(struct i2c_client *client);
int cx25840_write(struct i2c_client *client, u16 addr, u8 value) int cx25840_write(struct i2c_client *client, u16 addr, u8 value)
{ {
...@@ -638,10 +638,13 @@ static void cx23885_initialize(struct i2c_client *client) ...@@ -638,10 +638,13 @@ static void cx23885_initialize(struct i2c_client *client)
finish_wait(&state->fw_wait, &wait); finish_wait(&state->fw_wait, &wait);
destroy_workqueue(q); destroy_workqueue(q);
/* Call the cx23885 specific std setup func, we no longer rely on /* Call the cx23888 specific std setup func, we no longer rely on
* the generic cx24840 func. * the generic cx24840 func.
*/ */
cx23885_std_setup(client); if (is_cx23888(state))
cx23888_std_setup(client);
else
cx25840_std_setup(client);
/* (re)set input */ /* (re)set input */
set_input(client, state->vid_input, state->aud_input); set_input(client, state->vid_input, state->aud_input);
...@@ -1103,9 +1106,23 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp ...@@ -1103,9 +1106,23 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
cx25840_write4(client, 0x410, 0xffff0dbf); cx25840_write4(client, 0x410, 0xffff0dbf);
cx25840_write4(client, 0x414, 0x00137d03); cx25840_write4(client, 0x414, 0x00137d03);
cx25840_write4(client, 0x418, 0x01008080);
/* on the 887, 0x418 is HSCALE_CTRL, on the 888 it is
CHROMA_CTRL */
if (is_cx23888(state))
cx25840_write4(client, 0x418, 0x01008080);
else
cx25840_write4(client, 0x418, 0x01000000);
cx25840_write4(client, 0x41c, 0x00000000); cx25840_write4(client, 0x41c, 0x00000000);
cx25840_write4(client, 0x420, 0x001c3e0f);
/* on the 887, 0x420 is CHROMA_CTRL, on the 888 it is
CRUSH_CTRL */
if (is_cx23888(state))
cx25840_write4(client, 0x420, 0x001c3e0f);
else
cx25840_write4(client, 0x420, 0x001c8282);
cx25840_write4(client, 0x42c, 0x42600000); cx25840_write4(client, 0x42c, 0x42600000);
cx25840_write4(client, 0x430, 0x0000039b); cx25840_write4(client, 0x430, 0x0000039b);
cx25840_write4(client, 0x438, 0x00000000); cx25840_write4(client, 0x438, 0x00000000);
...@@ -1233,7 +1250,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp ...@@ -1233,7 +1250,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
cx25840_write4(client, 0x8d0, 0x1f063870); cx25840_write4(client, 0x8d0, 0x1f063870);
} }
if (is_cx2388x(state)) { if (is_cx23888(state)) {
/* HVR1850 */ /* HVR1850 */
/* AUD_IO_CTRL - I2S Input, Parallel1*/ /* AUD_IO_CTRL - I2S Input, Parallel1*/
/* - Channel 1 src - Parallel1 (Merlin out) */ /* - Channel 1 src - Parallel1 (Merlin out) */
...@@ -1298,8 +1315,8 @@ static int set_v4lstd(struct i2c_client *client) ...@@ -1298,8 +1315,8 @@ static int set_v4lstd(struct i2c_client *client)
} }
cx25840_and_or(client, 0x400, ~0xf, fmt); cx25840_and_or(client, 0x400, ~0xf, fmt);
cx25840_and_or(client, 0x403, ~0x3, pal_m); cx25840_and_or(client, 0x403, ~0x3, pal_m);
if (is_cx2388x(state)) if (is_cx23888(state))
cx23885_std_setup(client); cx23888_std_setup(client);
else else
cx25840_std_setup(client); cx25840_std_setup(client);
if (!is_cx2583x(state)) if (!is_cx2583x(state))
...@@ -1312,6 +1329,7 @@ static int set_v4lstd(struct i2c_client *client) ...@@ -1312,6 +1329,7 @@ static int set_v4lstd(struct i2c_client *client)
static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct v4l2_subdev *sd = to_sd(ctrl); struct v4l2_subdev *sd = to_sd(ctrl);
struct cx25840_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
switch (ctrl->id) { switch (ctrl->id) {
...@@ -1324,12 +1342,20 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1324,12 +1342,20 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
break; break;
case V4L2_CID_SATURATION: case V4L2_CID_SATURATION:
cx25840_write(client, 0x420, ctrl->val << 1); if (is_cx23888(state)) {
cx25840_write(client, 0x421, ctrl->val << 1); cx25840_write(client, 0x418, ctrl->val << 1);
cx25840_write(client, 0x419, ctrl->val << 1);
} else {
cx25840_write(client, 0x420, ctrl->val << 1);
cx25840_write(client, 0x421, ctrl->val << 1);
}
break; break;
case V4L2_CID_HUE: case V4L2_CID_HUE:
cx25840_write(client, 0x422, ctrl->val); if (is_cx23888(state))
cx25840_write(client, 0x41a, ctrl->val);
else
cx25840_write(client, 0x422, ctrl->val);
break; break;
default: default:
...@@ -1354,11 +1380,21 @@ static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt ...@@ -1354,11 +1380,21 @@ static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt
fmt->field = V4L2_FIELD_INTERLACED; fmt->field = V4L2_FIELD_INTERLACED;
fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; if (is_cx23888(state)) {
Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; Vsrc = (cx25840_read(client, 0x42a) & 0x3f) << 4;
Vsrc |= (cx25840_read(client, 0x429) & 0xf0) >> 4;
} else {
Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4;
Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4;
}
Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; if (is_cx23888(state)) {
Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; Hsrc = (cx25840_read(client, 0x426) & 0x3f) << 4;
Hsrc |= (cx25840_read(client, 0x425) & 0xf0) >> 4;
} else {
Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4;
Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4;
}
Vlines = fmt->height + (is_50Hz ? 4 : 7); Vlines = fmt->height + (is_50Hz ? 4 : 7);
...@@ -1782,8 +1818,8 @@ static int cx25840_s_video_routing(struct v4l2_subdev *sd, ...@@ -1782,8 +1818,8 @@ static int cx25840_s_video_routing(struct v4l2_subdev *sd,
struct cx25840_state *state = to_state(sd); struct cx25840_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
if (is_cx2388x(state)) if (is_cx23888(state))
cx23885_std_setup(client); cx23888_std_setup(client);
return set_input(client, input, state->aud_input); return set_input(client, input, state->aud_input);
} }
...@@ -1794,8 +1830,8 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd, ...@@ -1794,8 +1830,8 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
struct cx25840_state *state = to_state(sd); struct cx25840_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
if (is_cx2388x(state)) if (is_cx23888(state))
cx23885_std_setup(client); cx23888_std_setup(client);
return set_input(client, state->vid_input, input); return set_input(client, state->vid_input, input);
} }
...@@ -4939,7 +4975,7 @@ void cx23885_dif_setup(struct i2c_client *client, u32 ifHz) ...@@ -4939,7 +4975,7 @@ void cx23885_dif_setup(struct i2c_client *client, u32 ifHz)
} }
} }
static void cx23885_std_setup(struct i2c_client *client) static void cx23888_std_setup(struct i2c_client *client)
{ {
struct cx25840_state *state = to_state(i2c_get_clientdata(client)); struct cx25840_state *state = to_state(i2c_get_clientdata(client));
v4l2_std_id std = state->std; v4l2_std_id std = state->std;
......
...@@ -2893,7 +2893,7 @@ static void request_module_async(struct work_struct *work) ...@@ -2893,7 +2893,7 @@ static void request_module_async(struct work_struct *work)
if (dev->board.has_dvb) if (dev->board.has_dvb)
request_module("em28xx-dvb"); request_module("em28xx-dvb");
if (dev->board.has_ir_i2c && !disable_ir) if (dev->board.ir_codes && !disable_ir)
request_module("em28xx-rc"); request_module("em28xx-rc");
} }
......
...@@ -888,12 +888,12 @@ static const struct preview_update update_attrs[] = { ...@@ -888,12 +888,12 @@ static const struct preview_update update_attrs[] = {
preview_config_contrast, preview_config_contrast,
NULL, NULL,
offsetof(struct prev_params, contrast), offsetof(struct prev_params, contrast),
0, true, 0, 0, true,
}, /* OMAP3ISP_PREV_BRIGHTNESS */ { }, /* OMAP3ISP_PREV_BRIGHTNESS */ {
preview_config_brightness, preview_config_brightness,
NULL, NULL,
offsetof(struct prev_params, brightness), offsetof(struct prev_params, brightness),
0, true, 0, 0, true,
}, },
}; };
...@@ -1102,7 +1102,7 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active) ...@@ -1102,7 +1102,7 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active)
unsigned int elv = prev->crop.top + prev->crop.height - 1; unsigned int elv = prev->crop.top + prev->crop.height - 1;
u32 features; u32 features;
if (format->code == V4L2_MBUS_FMT_Y10_1X10) { if (format->code != V4L2_MBUS_FMT_Y10_1X10) {
sph -= 2; sph -= 2;
eph += 2; eph += 2;
slv -= 2; slv -= 2;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mutex.h> #include <linux/mutex.h>
......
...@@ -350,7 +350,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, ...@@ -350,7 +350,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
if (pixm) if (pixm)
sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); sizes[i] = max(size, pixm->plane_fmt[i].sizeimage);
else else
sizes[i] = size; sizes[i] = max_t(u32, size, frame->payload[i]);
allocators[i] = ctx->fimc_dev->alloc_ctx; allocators[i] = ctx->fimc_dev->alloc_ctx;
} }
...@@ -479,37 +480,39 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc); ...@@ -479,37 +480,39 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc);
static int fimc_capture_open(struct file *file) static int fimc_capture_open(struct file *file)
{ {
struct fimc_dev *fimc = video_drvdata(file); struct fimc_dev *fimc = video_drvdata(file);
int ret = v4l2_fh_open(file); int ret;
if (ret)
return ret;
dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state);
/* Return if the corresponding video mem2mem node is already opened. */
if (fimc_m2m_active(fimc)) if (fimc_m2m_active(fimc))
return -EBUSY; return -EBUSY;
set_bit(ST_CAPT_BUSY, &fimc->state); set_bit(ST_CAPT_BUSY, &fimc->state);
pm_runtime_get_sync(&fimc->pdev->dev); ret = pm_runtime_get_sync(&fimc->pdev->dev);
if (ret < 0)
return ret;
if (++fimc->vid_cap.refcnt == 1) { ret = v4l2_fh_open(file);
ret = fimc_pipeline_initialize(&fimc->pipeline, if (ret)
&fimc->vid_cap.vfd->entity, true); return ret;
if (ret < 0) {
dev_err(&fimc->pdev->dev,
"Video pipeline initialization failed\n");
pm_runtime_put_sync(&fimc->pdev->dev);
fimc->vid_cap.refcnt--;
v4l2_fh_release(file);
clear_bit(ST_CAPT_BUSY, &fimc->state);
return ret;
}
ret = fimc_capture_ctrls_create(fimc);
if (!ret && !fimc->vid_cap.user_subdev_api) if (++fimc->vid_cap.refcnt != 1)
ret = fimc_capture_set_default_format(fimc); return 0;
ret = fimc_pipeline_initialize(&fimc->pipeline,
&fimc->vid_cap.vfd->entity, true);
if (ret < 0) {
clear_bit(ST_CAPT_BUSY, &fimc->state);
pm_runtime_put_sync(&fimc->pdev->dev);
fimc->vid_cap.refcnt--;
v4l2_fh_release(file);
return ret;
} }
ret = fimc_capture_ctrls_create(fimc);
if (!ret && !fimc->vid_cap.user_subdev_api)
ret = fimc_capture_set_default_format(fimc);
return ret; return ret;
} }
...@@ -818,9 +821,6 @@ static int fimc_cap_g_fmt_mplane(struct file *file, void *fh, ...@@ -818,9 +821,6 @@ static int fimc_cap_g_fmt_mplane(struct file *file, void *fh,
struct fimc_dev *fimc = video_drvdata(file); struct fimc_dev *fimc = video_drvdata(file);
struct fimc_ctx *ctx = fimc->vid_cap.ctx; struct fimc_ctx *ctx = fimc->vid_cap.ctx;
if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
return -EINVAL;
return fimc_fill_format(&ctx->d_frame, f); return fimc_fill_format(&ctx->d_frame, f);
} }
...@@ -833,9 +833,6 @@ static int fimc_cap_try_fmt_mplane(struct file *file, void *fh, ...@@ -833,9 +833,6 @@ static int fimc_cap_try_fmt_mplane(struct file *file, void *fh,
struct v4l2_mbus_framefmt mf; struct v4l2_mbus_framefmt mf;
struct fimc_fmt *ffmt = NULL; struct fimc_fmt *ffmt = NULL;
if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
return -EINVAL;
if (pix->pixelformat == V4L2_PIX_FMT_JPEG) { if (pix->pixelformat == V4L2_PIX_FMT_JPEG) {
fimc_capture_try_format(ctx, &pix->width, &pix->height, fimc_capture_try_format(ctx, &pix->width, &pix->height,
NULL, &pix->pixelformat, NULL, &pix->pixelformat,
...@@ -887,8 +884,6 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) ...@@ -887,8 +884,6 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f)
struct fimc_fmt *s_fmt = NULL; struct fimc_fmt *s_fmt = NULL;
int ret, i; int ret, i;
if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
return -EINVAL;
if (vb2_is_busy(&fimc->vid_cap.vbq)) if (vb2_is_busy(&fimc->vid_cap.vbq))
return -EBUSY; return -EBUSY;
...@@ -924,10 +919,10 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) ...@@ -924,10 +919,10 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f)
pix->width = mf->width; pix->width = mf->width;
pix->height = mf->height; pix->height = mf->height;
} }
fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix);
for (i = 0; i < ff->fmt->colplanes; i++) for (i = 0; i < ff->fmt->colplanes; i++)
ff->payload[i] = ff->payload[i] = pix->plane_fmt[i].sizeimage;
(pix->width * pix->height * ff->fmt->depth[i]) / 8;
set_frame_bounds(ff, pix->width, pix->height); set_frame_bounds(ff, pix->width, pix->height);
/* Reset the composition rectangle if not yet configured */ /* Reset the composition rectangle if not yet configured */
...@@ -1045,18 +1040,22 @@ static int fimc_cap_streamon(struct file *file, void *priv, ...@@ -1045,18 +1040,22 @@ static int fimc_cap_streamon(struct file *file, void *priv,
{ {
struct fimc_dev *fimc = video_drvdata(file); struct fimc_dev *fimc = video_drvdata(file);
struct fimc_pipeline *p = &fimc->pipeline; struct fimc_pipeline *p = &fimc->pipeline;
struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR];
int ret; int ret;
if (fimc_capture_active(fimc)) if (fimc_capture_active(fimc))
return -EBUSY; return -EBUSY;
media_entity_pipeline_start(&p->subdevs[IDX_SENSOR]->entity, ret = media_entity_pipeline_start(&sd->entity, p->m_pipeline);
p->m_pipeline); if (ret < 0)
return ret;
if (fimc->vid_cap.user_subdev_api) { if (fimc->vid_cap.user_subdev_api) {
ret = fimc_pipeline_validate(fimc); ret = fimc_pipeline_validate(fimc);
if (ret) if (ret < 0) {
media_entity_pipeline_stop(&sd->entity);
return ret; return ret;
}
} }
return vb2_streamon(&fimc->vid_cap.vbq, type); return vb2_streamon(&fimc->vid_cap.vbq, type);
} }
......
...@@ -153,7 +153,7 @@ static struct fimc_fmt fimc_formats[] = { ...@@ -153,7 +153,7 @@ static struct fimc_fmt fimc_formats[] = {
.colplanes = 2, .colplanes = 2,
.flags = FMT_FLAGS_M2M, .flags = FMT_FLAGS_M2M,
}, { }, {
.name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr", .name = "YUV 4:2:0 non-contig. 2p, Y/CbCr",
.fourcc = V4L2_PIX_FMT_NV12M, .fourcc = V4L2_PIX_FMT_NV12M,
.color = FIMC_FMT_YCBCR420, .color = FIMC_FMT_YCBCR420,
.depth = { 8, 4 }, .depth = { 8, 4 },
...@@ -161,7 +161,7 @@ static struct fimc_fmt fimc_formats[] = { ...@@ -161,7 +161,7 @@ static struct fimc_fmt fimc_formats[] = {
.colplanes = 2, .colplanes = 2,
.flags = FMT_FLAGS_M2M, .flags = FMT_FLAGS_M2M,
}, { }, {
.name = "YUV 4:2:0 non-contiguous 3-planar, Y/Cb/Cr", .name = "YUV 4:2:0 non-contig. 3p, Y/Cb/Cr",
.fourcc = V4L2_PIX_FMT_YUV420M, .fourcc = V4L2_PIX_FMT_YUV420M,
.color = FIMC_FMT_YCBCR420, .color = FIMC_FMT_YCBCR420,
.depth = { 8, 2, 2 }, .depth = { 8, 2, 2 },
...@@ -169,7 +169,7 @@ static struct fimc_fmt fimc_formats[] = { ...@@ -169,7 +169,7 @@ static struct fimc_fmt fimc_formats[] = {
.colplanes = 3, .colplanes = 3,
.flags = FMT_FLAGS_M2M, .flags = FMT_FLAGS_M2M,
}, { }, {
.name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr, tiled", .name = "YUV 4:2:0 non-contig. 2p, tiled",
.fourcc = V4L2_PIX_FMT_NV12MT, .fourcc = V4L2_PIX_FMT_NV12MT,
.color = FIMC_FMT_YCBCR420, .color = FIMC_FMT_YCBCR420,
.depth = { 8, 4 }, .depth = { 8, 4 },
...@@ -641,7 +641,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active) ...@@ -641,7 +641,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active)
if (!ctrls->ready) if (!ctrls->ready)
return; return;
mutex_lock(&ctrls->handler.lock); mutex_lock(ctrls->handler.lock);
v4l2_ctrl_activate(ctrls->rotate, active); v4l2_ctrl_activate(ctrls->rotate, active);
v4l2_ctrl_activate(ctrls->hflip, active); v4l2_ctrl_activate(ctrls->hflip, active);
v4l2_ctrl_activate(ctrls->vflip, active); v4l2_ctrl_activate(ctrls->vflip, active);
...@@ -660,7 +660,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active) ...@@ -660,7 +660,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active)
ctx->hflip = 0; ctx->hflip = 0;
ctx->vflip = 0; ctx->vflip = 0;
} }
mutex_unlock(&ctrls->handler.lock); mutex_unlock(ctrls->handler.lock);
} }
/* Update maximum value of the alpha color control */ /* Update maximum value of the alpha color control */
...@@ -741,8 +741,8 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, ...@@ -741,8 +741,8 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height,
pix->width = width; pix->width = width;
for (i = 0; i < pix->num_planes; ++i) { for (i = 0; i < pix->num_planes; ++i) {
u32 bpl = pix->plane_fmt[i].bytesperline; struct v4l2_plane_pix_format *plane_fmt = &pix->plane_fmt[i];
u32 *sizeimage = &pix->plane_fmt[i].sizeimage; u32 bpl = plane_fmt->bytesperline;
if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width))
bpl = pix->width; /* Planar */ bpl = pix->width; /* Planar */
...@@ -754,8 +754,9 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, ...@@ -754,8 +754,9 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height,
if (i == 0) /* Same bytesperline for each plane. */ if (i == 0) /* Same bytesperline for each plane. */
bytesperline = bpl; bytesperline = bpl;
pix->plane_fmt[i].bytesperline = bytesperline; plane_fmt->bytesperline = bytesperline;
*sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; plane_fmt->sizeimage = max((pix->width * pix->height *
fmt->depth[i]) / 8, plane_fmt->sizeimage);
} }
} }
......
...@@ -451,34 +451,44 @@ static void fimc_lite_clear_event_counters(struct fimc_lite *fimc) ...@@ -451,34 +451,44 @@ static void fimc_lite_clear_event_counters(struct fimc_lite *fimc)
static int fimc_lite_open(struct file *file) static int fimc_lite_open(struct file *file)
{ {
struct fimc_lite *fimc = video_drvdata(file); struct fimc_lite *fimc = video_drvdata(file);
int ret = v4l2_fh_open(file); int ret;
if (ret) if (mutex_lock_interruptible(&fimc->lock))
return ret; return -ERESTARTSYS;
set_bit(ST_FLITE_IN_USE, &fimc->state); set_bit(ST_FLITE_IN_USE, &fimc->state);
pm_runtime_get_sync(&fimc->pdev->dev); ret = pm_runtime_get_sync(&fimc->pdev->dev);
if (ret < 0)
goto done;
if (++fimc->ref_count != 1 || fimc->out_path != FIMC_IO_DMA) ret = v4l2_fh_open(file);
return ret; if (ret < 0)
goto done;
ret = fimc_pipeline_initialize(&fimc->pipeline, &fimc->vfd->entity, if (++fimc->ref_count == 1 && fimc->out_path == FIMC_IO_DMA) {
true); ret = fimc_pipeline_initialize(&fimc->pipeline,
if (ret < 0) { &fimc->vfd->entity, true);
v4l2_err(fimc->vfd, "Video pipeline initialization failed\n"); if (ret < 0) {
pm_runtime_put_sync(&fimc->pdev->dev); pm_runtime_put_sync(&fimc->pdev->dev);
fimc->ref_count--; fimc->ref_count--;
v4l2_fh_release(file); v4l2_fh_release(file);
clear_bit(ST_FLITE_IN_USE, &fimc->state); clear_bit(ST_FLITE_IN_USE, &fimc->state);
} }
fimc_lite_clear_event_counters(fimc); fimc_lite_clear_event_counters(fimc);
}
done:
mutex_unlock(&fimc->lock);
return ret; return ret;
} }
static int fimc_lite_close(struct file *file) static int fimc_lite_close(struct file *file)
{ {
struct fimc_lite *fimc = video_drvdata(file); struct fimc_lite *fimc = video_drvdata(file);
int ret;
if (mutex_lock_interruptible(&fimc->lock))
return -ERESTARTSYS;
if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) {
clear_bit(ST_FLITE_IN_USE, &fimc->state); clear_bit(ST_FLITE_IN_USE, &fimc->state);
...@@ -492,20 +502,39 @@ static int fimc_lite_close(struct file *file) ...@@ -492,20 +502,39 @@ static int fimc_lite_close(struct file *file)
if (fimc->ref_count == 0) if (fimc->ref_count == 0)
vb2_queue_release(&fimc->vb_queue); vb2_queue_release(&fimc->vb_queue);
return v4l2_fh_release(file); ret = v4l2_fh_release(file);
mutex_unlock(&fimc->lock);
return ret;
} }
static unsigned int fimc_lite_poll(struct file *file, static unsigned int fimc_lite_poll(struct file *file,
struct poll_table_struct *wait) struct poll_table_struct *wait)
{ {
struct fimc_lite *fimc = video_drvdata(file); struct fimc_lite *fimc = video_drvdata(file);
return vb2_poll(&fimc->vb_queue, file, wait); int ret;
if (mutex_lock_interruptible(&fimc->lock))
return POLL_ERR;
ret = vb2_poll(&fimc->vb_queue, file, wait);
mutex_unlock(&fimc->lock);
return ret;
} }
static int fimc_lite_mmap(struct file *file, struct vm_area_struct *vma) static int fimc_lite_mmap(struct file *file, struct vm_area_struct *vma)
{ {
struct fimc_lite *fimc = video_drvdata(file); struct fimc_lite *fimc = video_drvdata(file);
return vb2_mmap(&fimc->vb_queue, vma); int ret;
if (mutex_lock_interruptible(&fimc->lock))
return -ERESTARTSYS;
ret = vb2_mmap(&fimc->vb_queue, vma);
mutex_unlock(&fimc->lock);
return ret;
} }
static const struct v4l2_file_operations fimc_lite_fops = { static const struct v4l2_file_operations fimc_lite_fops = {
...@@ -762,7 +791,9 @@ static int fimc_lite_streamon(struct file *file, void *priv, ...@@ -762,7 +791,9 @@ static int fimc_lite_streamon(struct file *file, void *priv,
if (fimc_lite_active(fimc)) if (fimc_lite_active(fimc))
return -EBUSY; return -EBUSY;
media_entity_pipeline_start(&sensor->entity, p->m_pipeline); ret = media_entity_pipeline_start(&sensor->entity, p->m_pipeline);
if (ret < 0)
return ret;
ret = fimc_pipeline_validate(fimc); ret = fimc_pipeline_validate(fimc);
if (ret) { if (ret) {
...@@ -1508,7 +1539,7 @@ static int fimc_lite_suspend(struct device *dev) ...@@ -1508,7 +1539,7 @@ static int fimc_lite_suspend(struct device *dev)
return 0; return 0;
ret = fimc_lite_stop_capture(fimc, suspend); ret = fimc_lite_stop_capture(fimc, suspend);
if (ret) if (ret < 0 || !fimc_lite_active(fimc))
return ret; return ret;
return fimc_pipeline_shutdown(&fimc->pipeline); return fimc_pipeline_shutdown(&fimc->pipeline);
......
...@@ -193,9 +193,13 @@ int __fimc_pipeline_shutdown(struct fimc_pipeline *p) ...@@ -193,9 +193,13 @@ int __fimc_pipeline_shutdown(struct fimc_pipeline *p)
int fimc_pipeline_shutdown(struct fimc_pipeline *p) int fimc_pipeline_shutdown(struct fimc_pipeline *p)
{ {
struct media_entity *me = &p->subdevs[IDX_SENSOR]->entity; struct media_entity *me;
int ret; int ret;
if (!p || !p->subdevs[IDX_SENSOR])
return -EINVAL;
me = &p->subdevs[IDX_SENSOR]->entity;
mutex_lock(&me->parent->graph_mutex); mutex_lock(&me->parent->graph_mutex);
ret = __fimc_pipeline_shutdown(p); ret = __fimc_pipeline_shutdown(p);
mutex_unlock(&me->parent->graph_mutex); mutex_unlock(&me->parent->graph_mutex);
...@@ -498,12 +502,12 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd) ...@@ -498,12 +502,12 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd)
* @source: the source entity to create links to all fimc entities from * @source: the source entity to create links to all fimc entities from
* @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null * @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null
* @pad: the source entity pad index * @pad: the source entity pad index
* @fimc_id: index of the fimc device for which link should be enabled * @link_mask: bitmask of the fimc devices for which link should be enabled
*/ */
static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,
struct media_entity *source, struct media_entity *source,
struct v4l2_subdev *sensor, struct v4l2_subdev *sensor,
int pad, int fimc_id) int pad, int link_mask)
{ {
struct fimc_sensor_info *s_info; struct fimc_sensor_info *s_info;
struct media_entity *sink; struct media_entity *sink;
...@@ -520,7 +524,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, ...@@ -520,7 +524,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,
if (!fmd->fimc[i]->variant->has_cam_if) if (!fmd->fimc[i]->variant->has_cam_if)
continue; continue;
flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; flags = ((1 << i) & link_mask) ? MEDIA_LNK_FL_ENABLED : 0;
sink = &fmd->fimc[i]->vid_cap.subdev.entity; sink = &fmd->fimc[i]->vid_cap.subdev.entity;
ret = media_entity_create_link(source, pad, sink, ret = media_entity_create_link(source, pad, sink,
...@@ -552,7 +556,10 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, ...@@ -552,7 +556,10 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd,
if (!fmd->fimc_lite[i]) if (!fmd->fimc_lite[i])
continue; continue;
flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; if (link_mask & (1 << (i + FIMC_MAX_DEVS)))
flags = MEDIA_LNK_FL_ENABLED;
else
flags = 0;
sink = &fmd->fimc_lite[i]->subdev.entity; sink = &fmd->fimc_lite[i]->subdev.entity;
ret = media_entity_create_link(source, pad, sink, ret = media_entity_create_link(source, pad, sink,
...@@ -614,9 +621,8 @@ static int fimc_md_create_links(struct fimc_md *fmd) ...@@ -614,9 +621,8 @@ static int fimc_md_create_links(struct fimc_md *fmd)
struct s5p_fimc_isp_info *pdata; struct s5p_fimc_isp_info *pdata;
struct fimc_sensor_info *s_info; struct fimc_sensor_info *s_info;
struct media_entity *source, *sink; struct media_entity *source, *sink;
int i, pad, fimc_id = 0; int i, pad, fimc_id = 0, ret = 0;
int ret = 0; u32 flags, link_mask = 0;
u32 flags;
for (i = 0; i < fmd->num_sensors; i++) { for (i = 0; i < fmd->num_sensors; i++) {
if (fmd->sensor[i].subdev == NULL) if (fmd->sensor[i].subdev == NULL)
...@@ -668,19 +674,20 @@ static int fimc_md_create_links(struct fimc_md *fmd) ...@@ -668,19 +674,20 @@ static int fimc_md_create_links(struct fimc_md *fmd)
if (source == NULL) if (source == NULL)
continue; continue;
link_mask = 1 << fimc_id++;
ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor, ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor,
pad, fimc_id++); pad, link_mask);
} }
fimc_id = 0;
for (i = 0; i < ARRAY_SIZE(fmd->csis); i++) { for (i = 0; i < ARRAY_SIZE(fmd->csis); i++) {
if (fmd->csis[i].sd == NULL) if (fmd->csis[i].sd == NULL)
continue; continue;
source = &fmd->csis[i].sd->entity; source = &fmd->csis[i].sd->entity;
pad = CSIS_PAD_SOURCE; pad = CSIS_PAD_SOURCE;
link_mask = 1 << fimc_id++;
ret = __fimc_md_create_fimc_sink_links(fmd, source, NULL, ret = __fimc_md_create_fimc_sink_links(fmd, source, NULL,
pad, fimc_id++); pad, link_mask);
} }
/* Create immutable links between each FIMC's subdev and video node */ /* Create immutable links between each FIMC's subdev and video node */
...@@ -734,8 +741,8 @@ static void fimc_md_put_clocks(struct fimc_md *fmd) ...@@ -734,8 +741,8 @@ static void fimc_md_put_clocks(struct fimc_md *fmd)
} }
static int __fimc_md_set_camclk(struct fimc_md *fmd, static int __fimc_md_set_camclk(struct fimc_md *fmd,
struct fimc_sensor_info *s_info, struct fimc_sensor_info *s_info,
bool on) bool on)
{ {
struct s5p_fimc_isp_info *pdata = s_info->pdata; struct s5p_fimc_isp_info *pdata = s_info->pdata;
struct fimc_camclk_info *camclk; struct fimc_camclk_info *camclk;
...@@ -744,12 +751,10 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ...@@ -744,12 +751,10 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL) if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL)
return -EINVAL; return -EINVAL;
if (s_info->clk_on == on)
return 0;
camclk = &fmd->camclk[pdata->clk_id]; camclk = &fmd->camclk[pdata->clk_id];
dbg("camclk %d, f: %lu, clk: %p, on: %d", dbg("camclk %d, f: %lu, use_count: %d, on: %d",
pdata->clk_id, pdata->clk_frequency, camclk, on); pdata->clk_id, pdata->clk_frequency, camclk->use_count, on);
if (on) { if (on) {
if (camclk->use_count > 0 && if (camclk->use_count > 0 &&
...@@ -760,11 +765,9 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ...@@ -760,11 +765,9 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
clk_set_rate(camclk->clock, pdata->clk_frequency); clk_set_rate(camclk->clock, pdata->clk_frequency);
camclk->frequency = pdata->clk_frequency; camclk->frequency = pdata->clk_frequency;
ret = clk_enable(camclk->clock); ret = clk_enable(camclk->clock);
dbg("Enabled camclk %d: f: %lu", pdata->clk_id,
clk_get_rate(camclk->clock));
} }
s_info->clk_on = 1;
dbg("Enabled camclk %d: f: %lu", pdata->clk_id,
clk_get_rate(camclk->clock));
return ret; return ret;
} }
...@@ -773,7 +776,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ...@@ -773,7 +776,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
if (--camclk->use_count == 0) { if (--camclk->use_count == 0) {
clk_disable(camclk->clock); clk_disable(camclk->clock);
s_info->clk_on = 0;
dbg("Disabled camclk %d", pdata->clk_id); dbg("Disabled camclk %d", pdata->clk_id);
} }
return ret; return ret;
...@@ -789,8 +791,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ...@@ -789,8 +791,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
* devices to which sensors can be attached, either directly or through * devices to which sensors can be attached, either directly or through
* the MIPI CSI receiver. The clock is allowed here to be used by * the MIPI CSI receiver. The clock is allowed here to be used by
* multiple sensors concurrently if they use same frequency. * multiple sensors concurrently if they use same frequency.
* The per sensor subdev clk_on attribute helps to synchronize accesses
* to the sclk_cam clocks from the video and media device nodes.
* This function should only be called when the graph mutex is held. * This function should only be called when the graph mutex is held.
*/ */
int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on) int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on)
......
...@@ -47,7 +47,6 @@ struct fimc_camclk_info { ...@@ -47,7 +47,6 @@ struct fimc_camclk_info {
* @pdata: sensor's atrributes passed as media device's platform data * @pdata: sensor's atrributes passed as media device's platform data
* @subdev: image sensor v4l2 subdev * @subdev: image sensor v4l2 subdev
* @host: fimc device the sensor is currently linked to * @host: fimc device the sensor is currently linked to
* @clk_on: sclk_cam clock's state associated with this subdev
* *
* This data structure applies to image sensor and the writeback subdevs. * This data structure applies to image sensor and the writeback subdevs.
*/ */
...@@ -55,7 +54,6 @@ struct fimc_sensor_info { ...@@ -55,7 +54,6 @@ struct fimc_sensor_info {
struct s5p_fimc_isp_info *pdata; struct s5p_fimc_isp_info *pdata;
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
struct fimc_dev *host; struct fimc_dev *host;
bool clk_on;
}; };
/** /**
......
...@@ -996,6 +996,7 @@ int s5p_mfc_dec_ctrls_setup(struct s5p_mfc_ctx *ctx) ...@@ -996,6 +996,7 @@ int s5p_mfc_dec_ctrls_setup(struct s5p_mfc_ctx *ctx)
for (i = 0; i < NUM_CTRLS; i++) { for (i = 0; i < NUM_CTRLS; i++) {
if (IS_MFC51_PRIV(controls[i].id)) { if (IS_MFC51_PRIV(controls[i].id)) {
memset(&cfg, 0, sizeof(struct v4l2_ctrl_config));
cfg.ops = &s5p_mfc_dec_ctrl_ops; cfg.ops = &s5p_mfc_dec_ctrl_ops;
cfg.id = controls[i].id; cfg.id = controls[i].id;
cfg.min = controls[i].minimum; cfg.min = controls[i].minimum;
......
...@@ -1773,6 +1773,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx) ...@@ -1773,6 +1773,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx)
} }
for (i = 0; i < NUM_CTRLS; i++) { for (i = 0; i < NUM_CTRLS; i++) {
if (IS_MFC51_PRIV(controls[i].id)) { if (IS_MFC51_PRIV(controls[i].id)) {
memset(&cfg, 0, sizeof(struct v4l2_ctrl_config));
cfg.ops = &s5p_mfc_enc_ctrl_ops; cfg.ops = &s5p_mfc_enc_ctrl_ops;
cfg.id = controls[i].id; cfg.id = controls[i].id;
cfg.min = controls[i].minimum; cfg.min = controls[i].minimum;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/v4l2-mediabus.h> #include <linux/v4l2-mediabus.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment