Commit graph

6 commits

Author SHA1 Message Date
Archit Taneja 62b2f026cd drm/bridge: adv7533: Change number of DSI lanes dynamically
Lower modes on ADV7533 require lower number of DSI lanes for correct
operation. If ADV7533 is being used with 4 DSI lanes, then switch the
lanes to 3 when the target mode's pixel clock is less than 80 Mhz.

Based on patch by Andy Green <andy.green@linaro.org>

Signed-off-by: Archit Taneja <architt@codeaurora.org>
2016-07-13 14:24:37 +05:30
Archit Taneja 78fa479d70 drm/bridge: adv7533: Use internal timing generator
ADV7533 provides an internal timing generator for certain modes that it
can't use the DSI clock directly.

We've observed that HDMI is more stable with the internal timing
generator, especially if there are instabilities in the DSI clock source.
The data spec also seems to recommend the usage of the timing generator
for all modes.

However, on some platforms, it's reported that enabling the timing
generator causes instabilities with the HDMI output.

Create a DT parameter that lets a platform explicitly disable the timing
generator. The timing generator is enabled by default.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
2016-07-13 14:24:37 +05:30
Archit Taneja 1e4d58cd7f drm/bridge: adv7533: Create a MIPI DSI device
In order to pass DSI specific parameters to the DSI host, we need the
driver to create a mipi_dsi_device DSI device that attaches to the
host.

Use of_graph helpers to get the DSI host DT node. Create a MIPI DSI
device using this host. Finally, attach this device to the DSI host.

Populate DT parameters (number of data lanes for now) that are required
for DSI RX to work correctly. Hardcode few other parameters (rgb,
embedded_sync) for now.

Select DRM_MIPI_DSI config option only when ADV7533 support is enabled.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
2016-07-13 14:24:37 +05:30
Archit Taneja 2437e7cd88 drm/bridge: adv7533: Initial support for ADV7533
ADV7533 is a DSI to HDMI encoder chip. It is a derivative of ADV7511,
with additional blocks to translate input DSI data to parallel RGB
data. Besides the ADV7511 I2C register map, it has additional registers
that require to be configured to activate the DSI Rx block.

Create a new config that enables ADV7533 support. Use DT compatible
strings to populate the ADV7533 type enum. Add minimal register
configurations belonging to the DSI/CEC register map. Keep the ADV7533
code in a separate file.

Originally worked on by Lars-Peter Clausen <lars@metafoo.de>

Signed-off-by: Archit Taneja <architt@codeaurora.org>
2016-07-13 14:24:36 +05:30
Archit Taneja f0bfcc22d9 drm/bridge: adv7511: Fix mutex deadlock when interrupts are disabled
When the adv7511 i2c client doesn't have an interrupt line, we observe a
deadlock on caused by trying to lock drm device's mode_config.mutex twice
in the same context.

Here is the sequence that causes it:

ioctl DRM_IOCTL_MODE_GETCONNECTOR from userspace
  drm_mode_getconnector (acquires mode_config mutex)
    connector->fill_modes()
    drm_helper_probe_single_connector_modes
      connector_funcs->get_modes
	adv7511_encoder_get_modes
	  adv7511_get_edid_block
	    adv7511_irq_process
	      drm_helper_hpd_irq_event (acquires mode_config mutex again)

In adv7511_irq_process, don't call drm_helper_hpd_irq_event when not
called from the interrupt handler. It doesn't serve any purpose there
anyway.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
2016-07-13 14:24:36 +05:30
Archit Taneja c582778900 drm/i2c: adv7511: Move to bridge folder
The driver has been converted to use drm_bridge instead of
drm_i2c_slave_encoder. We can now move it to the bridge folder.

Create a separate folder since we already have a couple of files and
expect more when we support audio and ADV7533.

Rename the driver to adv7511_drv.c. This will come in handy later
when the driver module will need to be built from multiple object
files.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
2016-07-13 14:24:35 +05:30