summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/adv7604.c
AgeCommit message (Collapse)Author
2015-03-02[media] media: adv7604: CP CSC uses a different register on adv7604 and adv7611jean-michel.hautbois@vodalys.com
The bits are the same, but register is 0xf4 on ADV7611 instead of 0xfc. When reading back the value in log_status, differentiate both. Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02[media] media: i2c: ADV7604: In free run mode, signal is lockedjean-michel.hautbois@vodalys.com
The CP_NON_STD_VIDEO bit indicates an input not aligned with DV timings. If there is no input, and chip is in free run mode, consider we are locked. Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com> [hans.verkuil@cisco.com: put both conditions in one 'if'] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27[media] media: i2c: adv7604: Remove some unused functionsRickard Strandqvist
Removes some functions that are not used anywhere: test_read() edid_read_block() dpp_write() dpp_read() esdp_write() esdp_read() cec_write_clr_set() This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27[media] media: i2c: adv7604.c: Remove some unused functionsRickard Strandqvist
Removes some functions that are not used anywhere: vblanking() hblanking() This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14[media] i2c: Make use of media_bus_format enumBoris BREZILLON
In order to have subsytem agnostic media bus format definitions we've moved media bus definitions to include/uapi/linux/media-bus-format.h and prefixed values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Replace all references to the old definitions in i2c drivers. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11[media] adv7604: Correct G/S_EDID behaviourHans Verkuil
In order to have v4l2-compliance tool pass the G/S_EDID some modifications where needed in the driver. In particular, the edid.reserved zone must be blanked. Based on a patch from Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>, but reworked it a bit. It should use 'data' (which depends on edid.present) instead of edid.blocks as the check whether edid data is present. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-10-09Merge branch 'patchwork' into v4l_for_linusMauro Carvalho Chehab
* patchwork: (544 commits) [media] ir-hix5hd2: fix build on c6x arch [media] pt3: fix DTV FE I2C driver load error paths Revert "[media] media: em28xx - remove reset_resume interface" [media] exynos4-is: fix some warnings when compiling on arm64 [media] usb drivers: use %zu instead of %zd [media] pci drivers: use %zu instead of %zd [media] dvb-frontends: use %zu instead of %zd [media] s5p-mfc: Fix several printk warnings [media] s5p_mfc_opr: Fix warnings [media] ti-vpe: Fix typecast [media] s3c-camif: fix dma_addr_t printks [media] s5p_mfc_opr_v6: get rid of warnings when compiled with 64 bits [media] s5p_mfc_opr_v5: Fix lots of warnings on x86_64 [media] em28xx: Fix identation [media] drxd: remove a dead code [media] saa7146: remove return after BUG() [media] cx88: remove return after BUG() [media] cx88: fix cards table CodingStyle [media] radio-sf16fmr2: declare some structs as static [media] radio-sf16fmi: declare pnp_attached as static ... Conflicts: Documentation/DocBook/media/v4l/compat.xml
2014-09-21[media] adv7604: fix inverted conditionHans Verkuil
The log_status function should show HDMI information, but the test checking for an HDMI input was inverted. Fix this. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: stable@vger.kernel.org # for v3.12 and up Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21[media] adv7604/adv7842: fix il_vbackporch typo and zero the structHans Verkuil
Both adv7604 and adv7842 had the same typo in the code that sets the vertical backporch for the second interlaced field: it was assigned to vbackporch instead of il_vbackporch. In addition, the timings struct wasn't zeroed in the adv7842 driver, leaving several fields to undefined values causing the timing match function to fail. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-07-04[media] adv7604: Update recommended writes for the adv7611Lars-Peter Clausen
Update the recommended writes to those mentioned in the Rev 1.5 version of the ADV7611 Register Settings Recommendations document released by Analog Devices. The document does not mention why the recommended settings have been updated, but presumably those are more fine tuned settings that can enhance performance in some cases. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add LLC polarity configurationLaurent Pinchart
Add an inv_llc_pol field to platform data to control the clock polarity. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Set HPD GPIO direction to outputLaurent Pinchart
The HPD GPIO is used as an output but its direction is never set. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add endpoint properties to DT bindingsLaurent Pinchart
Add support for the hsync-active, vsync-active and pclk-sample properties to the DT bindings and control BT.656 mode implicitly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add DT supportLaurent Pinchart
Parse the device tree node to populate platform data. Only the ADV7611 is currently support with DT. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Specify the default input through platform dataLaurent Pinchart
And set input routing when initializing the device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Support hot-plug detect control through a GPIOLaurent Pinchart
Add support for optional GPIO-controlled HPD pins in addition to the ADV7604-specific hotplug notifier. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Sort headers alphabeticallyLaurent Pinchart
This helps locating duplicates and inserting new headers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Replace *_and_or() functions with *_clr_set()Laurent Pinchart
The *_and_or() functions take an 'and' bitmask to be ANDed with the register value before ORing it with th 'or' bitmask. As the functions are used to mask and set bits selectively, this requires the caller to invert the 'and' bitmask and is thus error prone. Replace those functions with a *_clr_set() variant that takes a mask of bits to be cleared instead of a mask of bits to be kept. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Store I2C addresses and clients in arraysLaurent Pinchart
This allows replacing duplicate code blocks by loops over the arrays. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Inline the to_sd functionLaurent Pinchart
This one line function is called in a single location. Inline it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Remove deprecated video-level DV timings operationsLaurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated and unused. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add pad-level DV timings supportLaurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated. Implement the pad-level version of those operations to prepare for the removal of the video version. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Make output format configurable through pad format operationsLaurent Pinchart
Replace the dummy video format operations by pad format operations that configure the output format. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Tested-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add sink padsLaurent Pinchart
The ADV7604 has sink pads for its HDMI and analog inputs. Report them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Remove subdev control handlersLaurent Pinchart
Control operations are handled by the control framework and the subdev control handlers are never called directly. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add adv7611 supportLars-Peter Clausen
This patch adds support for the Analog Devices ADV7611 HDMI receiver. The adv7611 is quite similar to the adv7604. It has only one instead of four HDMI inputs and no analog frontend though. Also some register bits have been shuffled around, but large parts of their register maps are compatible. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Cache register contents when reading multiple bitsLaurent Pinchart
When extracting multiple bits from a single register read the register once and extract the bits on the read value. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add 16-bit read functions for CP and HDMILaurent Pinchart
16-bit registers are read through two 8-bit read operations. Factorize that common pattern into 16-bit read accessors to simplify the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Don't put info string arrays on the stackLars-Peter Clausen
We do not want to modify the info string arrays ever, so no need to waste stack space for them. While we are at it also make them const. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] adv7604: Add support for asynchronous probingLars-Peter Clausen
Register the device with the v4l2 asynchronous probing framework to support asynchronous instantiation systems such as DT. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-25[media] v4l: Validate fields in the core code for subdev EDID ioctlsLaurent Pinchart
The subdev EDID ioctls receive a pad field that must reference an existing pad and an EDID field that must point to a buffer. Validate both fields in the core code instead of duplicating validation in all drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11[media] adv*: replace the deprecated v4l2_subdev_edid by v4l2_edidHans Verkuil
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: initialize timings to CEA 640x480p59.94Hans Verkuil
This timing must be supported by all HDMI equipment, so that's a reasonable default. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: sync polarities from platform dataMartin Bugge
Signed-off-by: Martin Bugge <marbugge@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: return immediately if the new timings are equal to what is ↵Mats Randgaard
configured Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: Enable HDMI_MODE interruptMats Randgaard
Some sources are initially detected as DVI, and change to HDMI later. This must be detected to set the right RGB quantization range. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: adjust gain and offset for DVI-D signalsMats Randgaard
If the input signal is DVI-D and quantization range is RGB full range, gain and offset must be adjusted to get the right range on the output. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: set restart_stdi_once flag when signal is lostMartin Bugge
If the restart_stdi_once trick fails to find a valid format the flag was never reset. Signed-off-by: Martin Bugge <marbugge@cisco.com> Cc: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: improve HDMI audio handlingMats Randgaard
- Mute audio before switching inputs to avoid noise/pops - Mute audio if audio FIFO over-/underflows (AD Recommended setting) - Reset FIFO if it over-/underflows (AD Recommended setting) Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: remove debouncing of ADV7604_FMT_CHANGE eventsMats Randgaard
ADV7604_FMT_CHANGE events was debounced in adv7604_isr() to avoid that a receiver with a unstable input signal would block the event handling for other inputs. This solution was prone to errors. A better protection agains interrupt blocking is to delay the call of the interrupt service routine in the adv7604 driver if too many interrupts are received within a given time. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: return immediately if the new input is equal to what is ↵Mats Randgaard
configured Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: remove connector type. Never used for anything usefulMats Randgaard
May also be wrong if the receiver is connected to more than one connector. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: improve EDID handlingMats Randgaard
- split edid_write_block() - do not use edid->edid before the validity check - Return -EINVAL if edid->pad is invalid - Save both registers for SPA port A - Set SPA location to default value if it is not found Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: set CEC address (SPA) in EDIDMats Randgaard
Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: select YPbPr if RGB_RANGE_FULL/LIMITED is set for VGA_COMP ↵Mats Randgaard
inputs Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: Receive CEA formats as RGB on VGA (RGB) inputMats Randgaard
If the input is ADV7604_INPUT_VGA_RGB and RGB quantization range is set to V4L2_DV_RGB_RANGE_AUTO, video with CEA timings will be received as RGB. For ADV7604_INPUT_VGA_COMP, automatic CSC mode will be selected. See table 44 on page 205 in "ADV7604 Hardware Manual, Rev. F, August 2010" for details. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: adv7604_s_register clean upHans Verkuil
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: support 1366x768 DMT Reduced BlankingMartin Bugge
Signed-off-by: Martin Bugge <marbugge@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: add hdmi driver strength adjustmentMikhail Khelik
The driver strength is board dependent, so set it from the platform_data. Signed-off-by: Mikhail Khelik <mkhelik@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-07[media] adv7604: add support for all the digital input portsMats Randgaard
The adv7604 supports four digital input ports. This patch adds support for all of them, instead of just port A. Signed-off-by: Mats Randgaard <matrandg@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>