aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/bridge
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-09 00:35:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-09 00:35:19 -0400
commita2d635decbfa9c1e4ae15cb05b68b2559f7f827c (patch)
tree1c3766c35215450ff9e4228efed578d5e6ba65d1 /drivers/gpu/drm/bridge
parent89c3b37af87ec183b666d83428cb28cc421671a6 (diff)
parenteb85d03e01c3e9f3b0ba7282b2e3515a635decb2 (diff)
Merge tag 'drm-next-2019-05-09' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie: "This has two exciting community drivers for ARM Mali accelerators. Since ARM has never been open source friendly on the GPU side of the house, the community has had to create open source drivers for the Mali GPUs. Lima covers the older t4xx and panfrost the newer 6xx/7xx series. Well done to all involved and hopefully this will help ARM head in the right direction. There is also now the ability if you don't have any of the legacy drivers enabled (pre-KMS) to remove all the pre-KMS support code from the core drm, this saves 10% or so in codesize on my machine. i915 also enable Icelake/Elkhart Lake Gen11 GPUs by default, vboxvideo moves out of staging. There are also some rcar-du patches which crossover with media tree but all should be acked by Mauro. Summary: uapi changes: - Colorspace connector property - fourcc - new YUV formts - timeline sync objects initially merged - expose FB_DAMAGE_CLIPS to atomic userspace new drivers: - vboxvideo: moved out of staging - aspeed: ASPEED SoC BMC chip display support - lima: ARM Mali4xx GPU acceleration driver support - panfrost: ARM Mali6xx/7xx Midgard/Bitfrost acceleration driver support core: - component helper docs - unplugging fixes - devm device init - MIPI/DSI rate control - shmem backed gem objects - connector, display_info, edid_quirks cleanups - dma_buf fence chain support - 64-bit dma-fence seqno comparison fixes - move initial fb config code to core - gem fence array helpers for Lima - ability to remove legacy support code if no drivers requires it (removes 10% of drm.ko size) - lease fixes ttm: - unified DRM_FILE_PAGE_OFFSET handling - Account for kernel allocations in kernel zone only panel: - OSD070T1718-19TS panel support - panel-tpo-td028ttec1 backlight support - Ronbo RB070D30 MIPI/DSI - Feiyang FY07024DI26A30-D MIPI-DSI panel - Rocktech jh057n00900 MIPI-DSI panel i915: - Comet Lake (Gen9) PCI IDs - Updated Icelake PCI IDs - Elkhartlake (Gen11) support - DP MST property addtions - plane and watermark fixes - Icelake port sync and VEBOX disable fixes - struct_mutex usage reduction - Icelake gamma fix - GuC reset fixes - make mmap more asynchronous - sound display power well race fixes - DDI/MIPI-DSI clocks for Icelake - Icelake RPS frequency changing support - Icelake workarounds amdgpu: - Use HMM for userptr - vega20 experimental smu11 support - RAS support for vega20 - BACO support for vega12 + fixes for vega20 - reworked IH interrupt handling - amdkfd RAS support - Freesync improvements - initial timeline sync object support - DC Z ordering fixes - NV12 planes support - colorspace properties for planes= - eDP opts if eDP already initialized nouveau: - misc fixes etnaviv: - misc fixes msm: - GPU zap shader support expansion - robustness ABI addition exynos: - Logging cleanups tegra: - Shared reset fix - CPU cache maintenance fix cirrus: - driver rewritten using simple helpers meson: - G12A support vmwgfx: - Resource dirtying management improvements - Userspace logging improvements virtio: - PRIME fixes rockchip: - rk3066 hdmi support sun4i: - DSI burst mode support vc4: - load tracker to detect underflow v3d: - v3d v4.2 support malidp: - initial Mali D71 support in komeda driver tfp410: - omap related improvement omapdrm: - drm bridge/panel support - drop some omap specific panels rcar-du: - Display writeback support" * tag 'drm-next-2019-05-09' of git://anongit.freedesktop.org/drm/drm: (1507 commits) drm/msm/a6xx: No zap shader is not an error drm/cma-helper: Fix drm_gem_cma_free_object() drm: Fix timestamp docs for variable refresh properties. drm/komeda: Mark the local functions as static drm/komeda: Fixed warning: Function parameter or member not described drm/komeda: Expose bus_width to Komeda-CORE drm/komeda: Add sysfs attribute: core_id and config_id drm: add non-desktop quirk for Valve HMDs drm/panfrost: Show stored feature registers drm/panfrost: Don't scream about deferred probe drm/panfrost: Disable PM on probe failure drm/panfrost: Set DMA masks earlier drm/panfrost: Add sanity checks to submit IOCTL drm/etnaviv: initialize idle mask before querying the HW db drm: introduce a capability flag for syncobj timeline support drm: report consistent errors when checking syncobj capibility drm/nouveau/nouveau: forward error generated while resuming objects tree drm/nouveau/fb/ramgk104: fix spelling mistake "sucessfully" -> "successfully" drm/nouveau/i2c: Disable i2c bus access after ->fini() drm/nouveau: Remove duplicate ACPI_VIDEO_NOTIFY_PROBE definition ...
Diffstat (limited to 'drivers/gpu/drm/bridge')
-rw-r--r--drivers/gpu/drm/bridge/dumb-vga-dac.c6
-rw-r--r--drivers/gpu/drm/bridge/tc358767.c4
-rw-r--r--drivers/gpu/drm/bridge/ti-tfp410.c140
3 files changed, 138 insertions, 12 deletions
diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
index 0805801f4e94..e64736c39a9f 100644
--- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
+++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
@@ -234,7 +234,7 @@ static int dumb_vga_remove(struct platform_device *pdev)
234 */ 234 */
235static const struct drm_bridge_timings default_dac_timings = { 235static const struct drm_bridge_timings default_dac_timings = {
236 /* Timing specifications, datasheet page 7 */ 236 /* Timing specifications, datasheet page 7 */
237 .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, 237 .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
238 .setup_time_ps = 500, 238 .setup_time_ps = 500,
239 .hold_time_ps = 1500, 239 .hold_time_ps = 1500,
240}; 240};
@@ -245,7 +245,7 @@ static const struct drm_bridge_timings default_dac_timings = {
245 */ 245 */
246static const struct drm_bridge_timings ti_ths8134_dac_timings = { 246static const struct drm_bridge_timings ti_ths8134_dac_timings = {
247 /* From timing diagram, datasheet page 9 */ 247 /* From timing diagram, datasheet page 9 */
248 .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, 248 .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
249 /* From datasheet, page 12 */ 249 /* From datasheet, page 12 */
250 .setup_time_ps = 3000, 250 .setup_time_ps = 3000,
251 /* I guess this means latched input */ 251 /* I guess this means latched input */
@@ -258,7 +258,7 @@ static const struct drm_bridge_timings ti_ths8134_dac_timings = {
258 */ 258 */
259static const struct drm_bridge_timings ti_ths8135_dac_timings = { 259static const struct drm_bridge_timings ti_ths8135_dac_timings = {
260 /* From timing diagram, datasheet page 14 */ 260 /* From timing diagram, datasheet page 14 */
261 .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, 261 .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
262 /* From datasheet, page 16 */ 262 /* From datasheet, page 16 */
263 .setup_time_ps = 2000, 263 .setup_time_ps = 2000,
264 .hold_time_ps = 500, 264 .hold_time_ps = 500,
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 888980d4bc74..e570c9dee180 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -1222,8 +1222,8 @@ static int tc_bridge_attach(struct drm_bridge *bridge)
1222 &bus_format, 1); 1222 &bus_format, 1);
1223 tc->connector.display_info.bus_flags = 1223 tc->connector.display_info.bus_flags =
1224 DRM_BUS_FLAG_DE_HIGH | 1224 DRM_BUS_FLAG_DE_HIGH |
1225 DRM_BUS_FLAG_PIXDATA_NEGEDGE | 1225 DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE |
1226 DRM_BUS_FLAG_SYNC_NEGEDGE; 1226 DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
1227 drm_connector_attach_encoder(&tc->connector, tc->bridge.encoder); 1227 drm_connector_attach_encoder(&tc->connector, tc->bridge.encoder);
1228 1228
1229 return 0; 1229 return 0;
diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index 7bfb4f338813..8b0e71bd3ca7 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -27,10 +27,16 @@
27struct tfp410 { 27struct tfp410 {
28 struct drm_bridge bridge; 28 struct drm_bridge bridge;
29 struct drm_connector connector; 29 struct drm_connector connector;
30 unsigned int connector_type;
30 31
32 u32 bus_format;
31 struct i2c_adapter *ddc; 33 struct i2c_adapter *ddc;
32 struct gpio_desc *hpd; 34 struct gpio_desc *hpd;
35 int hpd_irq;
33 struct delayed_work hpd_work; 36 struct delayed_work hpd_work;
37 struct gpio_desc *powerdown;
38
39 struct drm_bridge_timings timings;
34 40
35 struct device *dev; 41 struct device *dev;
36}; 42};
@@ -120,26 +126,47 @@ static int tfp410_attach(struct drm_bridge *bridge)
120 return -ENODEV; 126 return -ENODEV;
121 } 127 }
122 128
123 if (dvi->hpd) 129 if (dvi->hpd_irq >= 0)
124 dvi->connector.polled = DRM_CONNECTOR_POLL_HPD; 130 dvi->connector.polled = DRM_CONNECTOR_POLL_HPD;
131 else
132 dvi->connector.polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
125 133
126 drm_connector_helper_add(&dvi->connector, 134 drm_connector_helper_add(&dvi->connector,
127 &tfp410_con_helper_funcs); 135 &tfp410_con_helper_funcs);
128 ret = drm_connector_init(bridge->dev, &dvi->connector, 136 ret = drm_connector_init(bridge->dev, &dvi->connector,
129 &tfp410_con_funcs, DRM_MODE_CONNECTOR_HDMIA); 137 &tfp410_con_funcs, dvi->connector_type);
130 if (ret) { 138 if (ret) {
131 dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret); 139 dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret);
132 return ret; 140 return ret;
133 } 141 }
134 142
143 drm_display_info_set_bus_formats(&dvi->connector.display_info,
144 &dvi->bus_format, 1);
145
135 drm_connector_attach_encoder(&dvi->connector, 146 drm_connector_attach_encoder(&dvi->connector,
136 bridge->encoder); 147 bridge->encoder);
137 148
138 return 0; 149 return 0;
139} 150}
140 151
152static void tfp410_enable(struct drm_bridge *bridge)
153{
154 struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
155
156 gpiod_set_value_cansleep(dvi->powerdown, 0);
157}
158
159static void tfp410_disable(struct drm_bridge *bridge)
160{
161 struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
162
163 gpiod_set_value_cansleep(dvi->powerdown, 1);
164}
165
141static const struct drm_bridge_funcs tfp410_bridge_funcs = { 166static const struct drm_bridge_funcs tfp410_bridge_funcs = {
142 .attach = tfp410_attach, 167 .attach = tfp410_attach,
168 .enable = tfp410_enable,
169 .disable = tfp410_disable,
143}; 170};
144 171
145static void tfp410_hpd_work_func(struct work_struct *work) 172static void tfp410_hpd_work_func(struct work_struct *work)
@@ -162,6 +189,83 @@ static irqreturn_t tfp410_hpd_irq_thread(int irq, void *arg)
162 return IRQ_HANDLED; 189 return IRQ_HANDLED;
163} 190}
164 191
192static const struct drm_bridge_timings tfp410_default_timings = {
193 .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE
194 | DRM_BUS_FLAG_DE_HIGH,
195 .setup_time_ps = 1200,
196 .hold_time_ps = 1300,
197};
198
199static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
200{
201 struct drm_bridge_timings *timings = &dvi->timings;
202 struct device_node *ep;
203 u32 pclk_sample = 0;
204 u32 bus_width = 24;
205 s32 deskew = 0;
206
207 /* Start with defaults. */
208 *timings = tfp410_default_timings;
209
210 if (i2c)
211 /*
212 * In I2C mode timings are configured through the I2C interface.
213 * As the driver doesn't support I2C configuration yet, we just
214 * go with the defaults (BSEL=1, DSEL=1, DKEN=0, EDGE=1).
215 */
216 return 0;
217
218 /*
219 * In non-I2C mode, timings are configured through the BSEL, DSEL, DKEN
220 * and EDGE pins. They are specified in DT through endpoint properties
221 * and vendor-specific properties.
222 */
223 ep = of_graph_get_endpoint_by_regs(dvi->dev->of_node, 0, 0);
224 if (!ep)
225 return -EINVAL;
226
227 /* Get the sampling edge from the endpoint. */
228 of_property_read_u32(ep, "pclk-sample", &pclk_sample);
229 of_property_read_u32(ep, "bus-width", &bus_width);
230 of_node_put(ep);
231
232 timings->input_bus_flags = DRM_BUS_FLAG_DE_HIGH;
233
234 switch (pclk_sample) {
235 case 0:
236 timings->input_bus_flags |= DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE
237 | DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE;
238 break;
239 case 1:
240 timings->input_bus_flags |= DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE
241 | DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE;
242 break;
243 default:
244 return -EINVAL;
245 }
246
247 switch (bus_width) {
248 case 12:
249 dvi->bus_format = MEDIA_BUS_FMT_RGB888_2X12_LE;
250 break;
251 case 24:
252 dvi->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
253 break;
254 default:
255 return -EINVAL;
256 }
257
258 /* Get the setup and hold time from vendor-specific properties. */
259 of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew);
260 if (deskew < -4 || deskew > 3)
261 return -EINVAL;
262
263 timings->setup_time_ps = min(0, 1200 - 350 * deskew);
264 timings->hold_time_ps = min(0, 1300 + 350 * deskew);
265
266 return 0;
267}
268
165static int tfp410_get_connector_properties(struct tfp410 *dvi) 269static int tfp410_get_connector_properties(struct tfp410 *dvi)
166{ 270{
167 struct device_node *connector_node, *ddc_phandle; 271 struct device_node *connector_node, *ddc_phandle;
@@ -172,6 +276,11 @@ static int tfp410_get_connector_properties(struct tfp410 *dvi)
172 if (!connector_node) 276 if (!connector_node)
173 return -ENODEV; 277 return -ENODEV;
174 278
279 if (of_device_is_compatible(connector_node, "hdmi-connector"))
280 dvi->connector_type = DRM_MODE_CONNECTOR_HDMIA;
281 else
282 dvi->connector_type = DRM_MODE_CONNECTOR_DVID;
283
175 dvi->hpd = fwnode_get_named_gpiod(&connector_node->fwnode, 284 dvi->hpd = fwnode_get_named_gpiod(&connector_node->fwnode,
176 "hpd-gpios", 0, GPIOD_IN, "hpd"); 285 "hpd-gpios", 0, GPIOD_IN, "hpd");
177 if (IS_ERR(dvi->hpd)) { 286 if (IS_ERR(dvi->hpd)) {
@@ -200,7 +309,7 @@ fail:
200 return ret; 309 return ret;
201} 310}
202 311
203static int tfp410_init(struct device *dev) 312static int tfp410_init(struct device *dev, bool i2c)
204{ 313{
205 struct tfp410 *dvi; 314 struct tfp410 *dvi;
206 int ret; 315 int ret;
@@ -217,16 +326,33 @@ static int tfp410_init(struct device *dev)
217 326
218 dvi->bridge.funcs = &tfp410_bridge_funcs; 327 dvi->bridge.funcs = &tfp410_bridge_funcs;
219 dvi->bridge.of_node = dev->of_node; 328 dvi->bridge.of_node = dev->of_node;
329 dvi->bridge.timings = &dvi->timings;
220 dvi->dev = dev; 330 dvi->dev = dev;
221 331
332 ret = tfp410_parse_timings(dvi, i2c);
333 if (ret)
334 goto fail;
335
222 ret = tfp410_get_connector_properties(dvi); 336 ret = tfp410_get_connector_properties(dvi);
223 if (ret) 337 if (ret)
224 goto fail; 338 goto fail;
225 339
226 if (dvi->hpd) { 340 dvi->powerdown = devm_gpiod_get_optional(dev, "powerdown",
341 GPIOD_OUT_HIGH);
342 if (IS_ERR(dvi->powerdown)) {
343 dev_err(dev, "failed to parse powerdown gpio\n");
344 return PTR_ERR(dvi->powerdown);
345 }
346
347 if (dvi->hpd)
348 dvi->hpd_irq = gpiod_to_irq(dvi->hpd);
349 else
350 dvi->hpd_irq = -ENXIO;
351
352 if (dvi->hpd_irq >= 0) {
227 INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func); 353 INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func);
228 354
229 ret = devm_request_threaded_irq(dev, gpiod_to_irq(dvi->hpd), 355 ret = devm_request_threaded_irq(dev, dvi->hpd_irq,
230 NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING | 356 NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING |
231 IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 357 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
232 "hdmi-hpd", dvi); 358 "hdmi-hpd", dvi);
@@ -264,7 +390,7 @@ static int tfp410_fini(struct device *dev)
264 390
265static int tfp410_probe(struct platform_device *pdev) 391static int tfp410_probe(struct platform_device *pdev)
266{ 392{
267 return tfp410_init(&pdev->dev); 393 return tfp410_init(&pdev->dev, false);
268} 394}
269 395
270static int tfp410_remove(struct platform_device *pdev) 396static int tfp410_remove(struct platform_device *pdev)
@@ -301,7 +427,7 @@ static int tfp410_i2c_probe(struct i2c_client *client,
301 return -ENXIO; 427 return -ENXIO;
302 } 428 }
303 429
304 return tfp410_init(&client->dev); 430 return tfp410_init(&client->dev, true);
305} 431}
306 432
307static int tfp410_i2c_remove(struct i2c_client *client) 433static int tfp410_i2c_remove(struct i2c_client *client)