1dc55ac3bSJyri Sarha /* 2dc55ac3bSJyri Sarha * Copyright (C) 2016 Texas Instruments 3dc55ac3bSJyri Sarha * Author: Jyri Sarha <jsarha@ti.com> 4dc55ac3bSJyri Sarha * 5dc55ac3bSJyri Sarha * This program is free software; you can redistribute it and/or modify it 6dc55ac3bSJyri Sarha * under the terms of the GNU General Public License version 2 as published by 7dc55ac3bSJyri Sarha * the Free Software Foundation. 8dc55ac3bSJyri Sarha * 9dc55ac3bSJyri Sarha */ 10dc55ac3bSJyri Sarha 11*f56c9202SChristopher Spinrath #include <linux/delay.h> 12*f56c9202SChristopher Spinrath #include <linux/fwnode.h> 13*f56c9202SChristopher Spinrath #include <linux/gpio/consumer.h> 14*f56c9202SChristopher Spinrath #include <linux/irq.h> 15dc55ac3bSJyri Sarha #include <linux/module.h> 16dc55ac3bSJyri Sarha #include <linux/of_graph.h> 17dc55ac3bSJyri Sarha #include <linux/platform_device.h> 18dc55ac3bSJyri Sarha #include <linux/i2c.h> 19dc55ac3bSJyri Sarha 20dc55ac3bSJyri Sarha #include <drm/drmP.h> 21dc55ac3bSJyri Sarha #include <drm/drm_atomic_helper.h> 22dc55ac3bSJyri Sarha #include <drm/drm_crtc.h> 23dc55ac3bSJyri Sarha #include <drm/drm_crtc_helper.h> 24dc55ac3bSJyri Sarha 25*f56c9202SChristopher Spinrath #define HOTPLUG_DEBOUNCE_MS 1100 26*f56c9202SChristopher Spinrath 27dc55ac3bSJyri Sarha struct tfp410 { 28dc55ac3bSJyri Sarha struct drm_bridge bridge; 29dc55ac3bSJyri Sarha struct drm_connector connector; 30dc55ac3bSJyri Sarha 31dc55ac3bSJyri Sarha struct i2c_adapter *ddc; 32*f56c9202SChristopher Spinrath struct gpio_desc *hpd; 33*f56c9202SChristopher Spinrath struct delayed_work hpd_work; 34dc55ac3bSJyri Sarha 35dc55ac3bSJyri Sarha struct device *dev; 36dc55ac3bSJyri Sarha }; 37dc55ac3bSJyri Sarha 38dc55ac3bSJyri Sarha static inline struct tfp410 * 39dc55ac3bSJyri Sarha drm_bridge_to_tfp410(struct drm_bridge *bridge) 40dc55ac3bSJyri Sarha { 41dc55ac3bSJyri Sarha return container_of(bridge, struct tfp410, bridge); 42dc55ac3bSJyri Sarha } 43dc55ac3bSJyri Sarha 44dc55ac3bSJyri Sarha static inline struct tfp410 * 45dc55ac3bSJyri Sarha drm_connector_to_tfp410(struct drm_connector *connector) 46dc55ac3bSJyri Sarha { 47dc55ac3bSJyri Sarha return container_of(connector, struct tfp410, connector); 48dc55ac3bSJyri Sarha } 49dc55ac3bSJyri Sarha 50dc55ac3bSJyri Sarha static int tfp410_get_modes(struct drm_connector *connector) 51dc55ac3bSJyri Sarha { 52dc55ac3bSJyri Sarha struct tfp410 *dvi = drm_connector_to_tfp410(connector); 53dc55ac3bSJyri Sarha struct edid *edid; 54dc55ac3bSJyri Sarha int ret; 55dc55ac3bSJyri Sarha 56dc55ac3bSJyri Sarha if (!dvi->ddc) 57dc55ac3bSJyri Sarha goto fallback; 58dc55ac3bSJyri Sarha 59dc55ac3bSJyri Sarha edid = drm_get_edid(connector, dvi->ddc); 60dc55ac3bSJyri Sarha if (!edid) { 61dc55ac3bSJyri Sarha DRM_INFO("EDID read failed. Fallback to standard modes\n"); 62dc55ac3bSJyri Sarha goto fallback; 63dc55ac3bSJyri Sarha } 64dc55ac3bSJyri Sarha 65dc55ac3bSJyri Sarha drm_mode_connector_update_edid_property(connector, edid); 66dc55ac3bSJyri Sarha 67dc55ac3bSJyri Sarha return drm_add_edid_modes(connector, edid); 68dc55ac3bSJyri Sarha fallback: 69dc55ac3bSJyri Sarha /* No EDID, fallback on the XGA standard modes */ 70dc55ac3bSJyri Sarha ret = drm_add_modes_noedid(connector, 1920, 1200); 71dc55ac3bSJyri Sarha 72dc55ac3bSJyri Sarha /* And prefer a mode pretty much anything can handle */ 73dc55ac3bSJyri Sarha drm_set_preferred_mode(connector, 1024, 768); 74dc55ac3bSJyri Sarha 75dc55ac3bSJyri Sarha return ret; 76dc55ac3bSJyri Sarha } 77dc55ac3bSJyri Sarha 78dc55ac3bSJyri Sarha static const struct drm_connector_helper_funcs tfp410_con_helper_funcs = { 79dc55ac3bSJyri Sarha .get_modes = tfp410_get_modes, 80dc55ac3bSJyri Sarha }; 81dc55ac3bSJyri Sarha 82dc55ac3bSJyri Sarha static enum drm_connector_status 83dc55ac3bSJyri Sarha tfp410_connector_detect(struct drm_connector *connector, bool force) 84dc55ac3bSJyri Sarha { 85dc55ac3bSJyri Sarha struct tfp410 *dvi = drm_connector_to_tfp410(connector); 86dc55ac3bSJyri Sarha 87*f56c9202SChristopher Spinrath if (dvi->hpd) { 88*f56c9202SChristopher Spinrath if (gpiod_get_value_cansleep(dvi->hpd)) 89*f56c9202SChristopher Spinrath return connector_status_connected; 90*f56c9202SChristopher Spinrath else 91*f56c9202SChristopher Spinrath return connector_status_disconnected; 92*f56c9202SChristopher Spinrath } 93*f56c9202SChristopher Spinrath 94dc55ac3bSJyri Sarha if (dvi->ddc) { 95dc55ac3bSJyri Sarha if (drm_probe_ddc(dvi->ddc)) 96dc55ac3bSJyri Sarha return connector_status_connected; 97dc55ac3bSJyri Sarha else 98dc55ac3bSJyri Sarha return connector_status_disconnected; 99dc55ac3bSJyri Sarha } 100dc55ac3bSJyri Sarha 101dc55ac3bSJyri Sarha return connector_status_unknown; 102dc55ac3bSJyri Sarha } 103dc55ac3bSJyri Sarha 104dc55ac3bSJyri Sarha static const struct drm_connector_funcs tfp410_con_funcs = { 105dc55ac3bSJyri Sarha .dpms = drm_atomic_helper_connector_dpms, 106dc55ac3bSJyri Sarha .detect = tfp410_connector_detect, 107dc55ac3bSJyri Sarha .fill_modes = drm_helper_probe_single_connector_modes, 108dc55ac3bSJyri Sarha .destroy = drm_connector_cleanup, 109dc55ac3bSJyri Sarha .reset = drm_atomic_helper_connector_reset, 110dc55ac3bSJyri Sarha .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 111dc55ac3bSJyri Sarha .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 112dc55ac3bSJyri Sarha }; 113dc55ac3bSJyri Sarha 114dc55ac3bSJyri Sarha static int tfp410_attach(struct drm_bridge *bridge) 115dc55ac3bSJyri Sarha { 116dc55ac3bSJyri Sarha struct tfp410 *dvi = drm_bridge_to_tfp410(bridge); 117dc55ac3bSJyri Sarha int ret; 118dc55ac3bSJyri Sarha 119dc55ac3bSJyri Sarha if (!bridge->encoder) { 120dc55ac3bSJyri Sarha dev_err(dvi->dev, "Missing encoder\n"); 121dc55ac3bSJyri Sarha return -ENODEV; 122dc55ac3bSJyri Sarha } 123dc55ac3bSJyri Sarha 124*f56c9202SChristopher Spinrath if (dvi->hpd) 125*f56c9202SChristopher Spinrath dvi->connector.polled = DRM_CONNECTOR_POLL_HPD; 126*f56c9202SChristopher Spinrath 127dc55ac3bSJyri Sarha drm_connector_helper_add(&dvi->connector, 128dc55ac3bSJyri Sarha &tfp410_con_helper_funcs); 129dc55ac3bSJyri Sarha ret = drm_connector_init(bridge->dev, &dvi->connector, 130dc55ac3bSJyri Sarha &tfp410_con_funcs, DRM_MODE_CONNECTOR_HDMIA); 131dc55ac3bSJyri Sarha if (ret) { 132dc55ac3bSJyri Sarha dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret); 133dc55ac3bSJyri Sarha return ret; 134dc55ac3bSJyri Sarha } 135dc55ac3bSJyri Sarha 136dc55ac3bSJyri Sarha drm_mode_connector_attach_encoder(&dvi->connector, 137dc55ac3bSJyri Sarha bridge->encoder); 138dc55ac3bSJyri Sarha 139dc55ac3bSJyri Sarha return 0; 140dc55ac3bSJyri Sarha } 141dc55ac3bSJyri Sarha 142dc55ac3bSJyri Sarha static const struct drm_bridge_funcs tfp410_bridge_funcs = { 143dc55ac3bSJyri Sarha .attach = tfp410_attach, 144dc55ac3bSJyri Sarha }; 145dc55ac3bSJyri Sarha 146*f56c9202SChristopher Spinrath static void tfp410_hpd_work_func(struct work_struct *work) 147*f56c9202SChristopher Spinrath { 148*f56c9202SChristopher Spinrath struct tfp410 *dvi; 149*f56c9202SChristopher Spinrath 150*f56c9202SChristopher Spinrath dvi = container_of(work, struct tfp410, hpd_work.work); 151*f56c9202SChristopher Spinrath 152*f56c9202SChristopher Spinrath if (dvi->bridge.dev) 153*f56c9202SChristopher Spinrath drm_helper_hpd_irq_event(dvi->bridge.dev); 154*f56c9202SChristopher Spinrath } 155*f56c9202SChristopher Spinrath 156*f56c9202SChristopher Spinrath static irqreturn_t tfp410_hpd_irq_thread(int irq, void *arg) 157*f56c9202SChristopher Spinrath { 158*f56c9202SChristopher Spinrath struct tfp410 *dvi = arg; 159*f56c9202SChristopher Spinrath 160*f56c9202SChristopher Spinrath mod_delayed_work(system_wq, &dvi->hpd_work, 161*f56c9202SChristopher Spinrath msecs_to_jiffies(HOTPLUG_DEBOUNCE_MS)); 162*f56c9202SChristopher Spinrath 163*f56c9202SChristopher Spinrath return IRQ_HANDLED; 164*f56c9202SChristopher Spinrath } 165*f56c9202SChristopher Spinrath 166*f56c9202SChristopher Spinrath static int tfp410_get_connector_properties(struct tfp410 *dvi) 167dc55ac3bSJyri Sarha { 168dc55ac3bSJyri Sarha struct device_node *ep = NULL, *connector_node = NULL; 169dc55ac3bSJyri Sarha struct device_node *ddc_phandle = NULL; 170dc55ac3bSJyri Sarha int ret = 0; 171dc55ac3bSJyri Sarha 172dc55ac3bSJyri Sarha /* port@1 is the connector node */ 173dc55ac3bSJyri Sarha ep = of_graph_get_endpoint_by_regs(dvi->dev->of_node, 1, -1); 174dc55ac3bSJyri Sarha if (!ep) 175dc55ac3bSJyri Sarha goto fail; 176dc55ac3bSJyri Sarha 177dc55ac3bSJyri Sarha connector_node = of_graph_get_remote_port_parent(ep); 178dc55ac3bSJyri Sarha if (!connector_node) 179dc55ac3bSJyri Sarha goto fail; 180dc55ac3bSJyri Sarha 181*f56c9202SChristopher Spinrath dvi->hpd = fwnode_get_named_gpiod(&connector_node->fwnode, 182*f56c9202SChristopher Spinrath "hpd-gpios", 0, GPIOD_IN, "hpd"); 183*f56c9202SChristopher Spinrath if (IS_ERR(dvi->hpd)) { 184*f56c9202SChristopher Spinrath ret = PTR_ERR(dvi->hpd); 185*f56c9202SChristopher Spinrath dvi->hpd = NULL; 186*f56c9202SChristopher Spinrath if (ret == -ENOENT) 187*f56c9202SChristopher Spinrath ret = 0; 188*f56c9202SChristopher Spinrath else 189*f56c9202SChristopher Spinrath goto fail; 190*f56c9202SChristopher Spinrath } 191*f56c9202SChristopher Spinrath 192dc55ac3bSJyri Sarha ddc_phandle = of_parse_phandle(connector_node, "ddc-i2c-bus", 0); 193dc55ac3bSJyri Sarha if (!ddc_phandle) 194dc55ac3bSJyri Sarha goto fail; 195dc55ac3bSJyri Sarha 196dc55ac3bSJyri Sarha dvi->ddc = of_get_i2c_adapter_by_node(ddc_phandle); 197dc55ac3bSJyri Sarha if (dvi->ddc) 198dc55ac3bSJyri Sarha dev_info(dvi->dev, "Connector's ddc i2c bus found\n"); 199dc55ac3bSJyri Sarha else 200dc55ac3bSJyri Sarha ret = -EPROBE_DEFER; 201dc55ac3bSJyri Sarha 202dc55ac3bSJyri Sarha fail: 203dc55ac3bSJyri Sarha of_node_put(ep); 204dc55ac3bSJyri Sarha of_node_put(connector_node); 205dc55ac3bSJyri Sarha of_node_put(ddc_phandle); 206dc55ac3bSJyri Sarha return ret; 207dc55ac3bSJyri Sarha } 208dc55ac3bSJyri Sarha 209dc55ac3bSJyri Sarha static int tfp410_init(struct device *dev) 210dc55ac3bSJyri Sarha { 211dc55ac3bSJyri Sarha struct tfp410 *dvi; 212dc55ac3bSJyri Sarha int ret; 213dc55ac3bSJyri Sarha 214dc55ac3bSJyri Sarha if (!dev->of_node) { 215dc55ac3bSJyri Sarha dev_err(dev, "device-tree data is missing\n"); 216dc55ac3bSJyri Sarha return -ENXIO; 217dc55ac3bSJyri Sarha } 218dc55ac3bSJyri Sarha 219dc55ac3bSJyri Sarha dvi = devm_kzalloc(dev, sizeof(*dvi), GFP_KERNEL); 220dc55ac3bSJyri Sarha if (!dvi) 221dc55ac3bSJyri Sarha return -ENOMEM; 222dc55ac3bSJyri Sarha dev_set_drvdata(dev, dvi); 223dc55ac3bSJyri Sarha 224dc55ac3bSJyri Sarha dvi->bridge.funcs = &tfp410_bridge_funcs; 225dc55ac3bSJyri Sarha dvi->bridge.of_node = dev->of_node; 226dc55ac3bSJyri Sarha dvi->dev = dev; 227dc55ac3bSJyri Sarha 228*f56c9202SChristopher Spinrath ret = tfp410_get_connector_properties(dvi); 229dc55ac3bSJyri Sarha if (ret) 230dc55ac3bSJyri Sarha goto fail; 231dc55ac3bSJyri Sarha 232*f56c9202SChristopher Spinrath if (dvi->hpd) { 233*f56c9202SChristopher Spinrath INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func); 234*f56c9202SChristopher Spinrath 235*f56c9202SChristopher Spinrath ret = devm_request_threaded_irq(dev, gpiod_to_irq(dvi->hpd), 236*f56c9202SChristopher Spinrath NULL, tfp410_hpd_irq_thread, IRQF_TRIGGER_RISING | 237*f56c9202SChristopher Spinrath IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 238*f56c9202SChristopher Spinrath "hdmi-hpd", dvi); 239*f56c9202SChristopher Spinrath if (ret) { 240*f56c9202SChristopher Spinrath DRM_ERROR("failed to register hpd interrupt\n"); 241*f56c9202SChristopher Spinrath goto fail; 242*f56c9202SChristopher Spinrath } 243*f56c9202SChristopher Spinrath } 244*f56c9202SChristopher Spinrath 245dc55ac3bSJyri Sarha ret = drm_bridge_add(&dvi->bridge); 246dc55ac3bSJyri Sarha if (ret) { 247dc55ac3bSJyri Sarha dev_err(dev, "drm_bridge_add() failed: %d\n", ret); 248dc55ac3bSJyri Sarha goto fail; 249dc55ac3bSJyri Sarha } 250dc55ac3bSJyri Sarha 251dc55ac3bSJyri Sarha return 0; 252dc55ac3bSJyri Sarha fail: 253dc55ac3bSJyri Sarha i2c_put_adapter(dvi->ddc); 254*f56c9202SChristopher Spinrath if (dvi->hpd) 255*f56c9202SChristopher Spinrath gpiod_put(dvi->hpd); 256dc55ac3bSJyri Sarha return ret; 257dc55ac3bSJyri Sarha } 258dc55ac3bSJyri Sarha 259dc55ac3bSJyri Sarha static int tfp410_fini(struct device *dev) 260dc55ac3bSJyri Sarha { 261dc55ac3bSJyri Sarha struct tfp410 *dvi = dev_get_drvdata(dev); 262dc55ac3bSJyri Sarha 263*f56c9202SChristopher Spinrath cancel_delayed_work_sync(&dvi->hpd_work); 264*f56c9202SChristopher Spinrath 265dc55ac3bSJyri Sarha drm_bridge_remove(&dvi->bridge); 266dc55ac3bSJyri Sarha 267dc55ac3bSJyri Sarha if (dvi->ddc) 268dc55ac3bSJyri Sarha i2c_put_adapter(dvi->ddc); 269*f56c9202SChristopher Spinrath if (dvi->hpd) 270*f56c9202SChristopher Spinrath gpiod_put(dvi->hpd); 271dc55ac3bSJyri Sarha 272dc55ac3bSJyri Sarha return 0; 273dc55ac3bSJyri Sarha } 274dc55ac3bSJyri Sarha 275dc55ac3bSJyri Sarha static int tfp410_probe(struct platform_device *pdev) 276dc55ac3bSJyri Sarha { 277dc55ac3bSJyri Sarha return tfp410_init(&pdev->dev); 278dc55ac3bSJyri Sarha } 279dc55ac3bSJyri Sarha 280dc55ac3bSJyri Sarha static int tfp410_remove(struct platform_device *pdev) 281dc55ac3bSJyri Sarha { 282dc55ac3bSJyri Sarha return tfp410_fini(&pdev->dev); 283dc55ac3bSJyri Sarha } 284dc55ac3bSJyri Sarha 285dc55ac3bSJyri Sarha static const struct of_device_id tfp410_match[] = { 286dc55ac3bSJyri Sarha { .compatible = "ti,tfp410" }, 287dc55ac3bSJyri Sarha {}, 288dc55ac3bSJyri Sarha }; 289dc55ac3bSJyri Sarha MODULE_DEVICE_TABLE(of, tfp410_match); 290dc55ac3bSJyri Sarha 2915b47d089SWei Yongjun static struct platform_driver tfp410_platform_driver = { 292dc55ac3bSJyri Sarha .probe = tfp410_probe, 293dc55ac3bSJyri Sarha .remove = tfp410_remove, 294dc55ac3bSJyri Sarha .driver = { 295dc55ac3bSJyri Sarha .name = "tfp410-bridge", 296dc55ac3bSJyri Sarha .of_match_table = tfp410_match, 297dc55ac3bSJyri Sarha }, 298dc55ac3bSJyri Sarha }; 299dc55ac3bSJyri Sarha 300dc55ac3bSJyri Sarha #if IS_ENABLED(CONFIG_I2C) 301dc55ac3bSJyri Sarha /* There is currently no i2c functionality. */ 302dc55ac3bSJyri Sarha static int tfp410_i2c_probe(struct i2c_client *client, 303dc55ac3bSJyri Sarha const struct i2c_device_id *id) 304dc55ac3bSJyri Sarha { 305dc55ac3bSJyri Sarha int reg; 306dc55ac3bSJyri Sarha 307dc55ac3bSJyri Sarha if (!client->dev.of_node || 308dc55ac3bSJyri Sarha of_property_read_u32(client->dev.of_node, "reg", ®)) { 309dc55ac3bSJyri Sarha dev_err(&client->dev, 310dc55ac3bSJyri Sarha "Can't get i2c reg property from device-tree\n"); 311dc55ac3bSJyri Sarha return -ENXIO; 312dc55ac3bSJyri Sarha } 313dc55ac3bSJyri Sarha 314dc55ac3bSJyri Sarha return tfp410_init(&client->dev); 315dc55ac3bSJyri Sarha } 316dc55ac3bSJyri Sarha 317dc55ac3bSJyri Sarha static int tfp410_i2c_remove(struct i2c_client *client) 318dc55ac3bSJyri Sarha { 319dc55ac3bSJyri Sarha return tfp410_fini(&client->dev); 320dc55ac3bSJyri Sarha } 321dc55ac3bSJyri Sarha 322dc55ac3bSJyri Sarha static const struct i2c_device_id tfp410_i2c_ids[] = { 323dc55ac3bSJyri Sarha { "tfp410", 0 }, 324dc55ac3bSJyri Sarha { } 325dc55ac3bSJyri Sarha }; 326dc55ac3bSJyri Sarha MODULE_DEVICE_TABLE(i2c, tfp410_i2c_ids); 327dc55ac3bSJyri Sarha 328dc55ac3bSJyri Sarha static struct i2c_driver tfp410_i2c_driver = { 329dc55ac3bSJyri Sarha .driver = { 330dc55ac3bSJyri Sarha .name = "tfp410", 331dc55ac3bSJyri Sarha .of_match_table = of_match_ptr(tfp410_match), 332dc55ac3bSJyri Sarha }, 333dc55ac3bSJyri Sarha .id_table = tfp410_i2c_ids, 334dc55ac3bSJyri Sarha .probe = tfp410_i2c_probe, 335dc55ac3bSJyri Sarha .remove = tfp410_i2c_remove, 336dc55ac3bSJyri Sarha }; 337dc55ac3bSJyri Sarha #endif /* IS_ENABLED(CONFIG_I2C) */ 338dc55ac3bSJyri Sarha 339dc55ac3bSJyri Sarha static struct { 340dc55ac3bSJyri Sarha uint i2c:1; 341dc55ac3bSJyri Sarha uint platform:1; 342dc55ac3bSJyri Sarha } tfp410_registered_driver; 343dc55ac3bSJyri Sarha 344dc55ac3bSJyri Sarha static int __init tfp410_module_init(void) 345dc55ac3bSJyri Sarha { 346dc55ac3bSJyri Sarha int ret; 347dc55ac3bSJyri Sarha 348dc55ac3bSJyri Sarha #if IS_ENABLED(CONFIG_I2C) 349dc55ac3bSJyri Sarha ret = i2c_add_driver(&tfp410_i2c_driver); 350dc55ac3bSJyri Sarha if (ret) 351dc55ac3bSJyri Sarha pr_err("%s: registering i2c driver failed: %d", 352dc55ac3bSJyri Sarha __func__, ret); 353dc55ac3bSJyri Sarha else 354dc55ac3bSJyri Sarha tfp410_registered_driver.i2c = 1; 355dc55ac3bSJyri Sarha #endif 356dc55ac3bSJyri Sarha 357dc55ac3bSJyri Sarha ret = platform_driver_register(&tfp410_platform_driver); 358dc55ac3bSJyri Sarha if (ret) 359dc55ac3bSJyri Sarha pr_err("%s: registering platform driver failed: %d", 360dc55ac3bSJyri Sarha __func__, ret); 361dc55ac3bSJyri Sarha else 362dc55ac3bSJyri Sarha tfp410_registered_driver.platform = 1; 363dc55ac3bSJyri Sarha 364dc55ac3bSJyri Sarha if (tfp410_registered_driver.i2c || 365dc55ac3bSJyri Sarha tfp410_registered_driver.platform) 366dc55ac3bSJyri Sarha return 0; 367dc55ac3bSJyri Sarha 368dc55ac3bSJyri Sarha return ret; 369dc55ac3bSJyri Sarha } 370dc55ac3bSJyri Sarha module_init(tfp410_module_init); 371dc55ac3bSJyri Sarha 372dc55ac3bSJyri Sarha static void __exit tfp410_module_exit(void) 373dc55ac3bSJyri Sarha { 374dc55ac3bSJyri Sarha #if IS_ENABLED(CONFIG_I2C) 375dc55ac3bSJyri Sarha if (tfp410_registered_driver.i2c) 376dc55ac3bSJyri Sarha i2c_del_driver(&tfp410_i2c_driver); 377dc55ac3bSJyri Sarha #endif 378dc55ac3bSJyri Sarha if (tfp410_registered_driver.platform) 379dc55ac3bSJyri Sarha platform_driver_unregister(&tfp410_platform_driver); 380dc55ac3bSJyri Sarha } 381dc55ac3bSJyri Sarha module_exit(tfp410_module_exit); 382dc55ac3bSJyri Sarha 383dc55ac3bSJyri Sarha MODULE_AUTHOR("Jyri Sarha <jsarha@ti.com>"); 384dc55ac3bSJyri Sarha MODULE_DESCRIPTION("TI TFP410 DVI bridge driver"); 385dc55ac3bSJyri Sarha MODULE_LICENSE("GPL"); 386