H A D | sti_vtg.c | 83 * @slave: slave vtg 98 static void vtg_register(struct sti_vtg *vtg) vtg_register() argument 100 list_add_tail(&vtg->link, &vtg_lookup); vtg_register() 105 struct sti_vtg *vtg; of_vtg_find() local 107 list_for_each_entry(vtg, &vtg_lookup, link) { of_vtg_find() 108 if (vtg->np == np) of_vtg_find() 109 return vtg; of_vtg_find() 115 static void vtg_reset(struct sti_vtg *vtg) vtg_reset() argument 118 if (vtg->slave) vtg_reset() 119 vtg_reset(vtg->slave); vtg_reset() 121 writel(1, vtg->regs + VTG_DRST_AUTOC); vtg_reset() 124 static void vtg_set_mode(struct sti_vtg *vtg, vtg_set_mode() argument 129 if (vtg->slave) vtg_set_mode() 130 vtg_set_mode(vtg->slave, VTG_TYPE_SLAVE_BY_EXT0, mode); vtg_set_mode() 132 writel(mode->htotal, vtg->regs + VTG_CLKLN); vtg_set_mode() 133 writel(mode->vtotal * 2, vtg->regs + VTG_HLFLN); vtg_set_mode() 137 writel(tmp, vtg->regs + VTG_VID_TFO); vtg_set_mode() 138 writel(tmp, vtg->regs + VTG_VID_BFO); vtg_set_mode() 142 writel(tmp, vtg->regs + VTG_VID_TFS); vtg_set_mode() 143 writel(tmp, vtg->regs + VTG_VID_BFS); vtg_set_mode() 148 writel(tmp, vtg->regs + VTG_H_HD_1); vtg_set_mode() 152 writel(tmp, vtg->regs + VTG_TOP_V_VD_1); vtg_set_mode() 153 writel(tmp, vtg->regs + VTG_BOT_V_VD_1); vtg_set_mode() 154 writel(0, vtg->regs + VTG_TOP_V_HD_1); vtg_set_mode() 155 writel(0, vtg->regs + VTG_BOT_V_HD_1); vtg_set_mode() 159 writel(tmp, vtg->regs + VTG_H_HD_2); vtg_set_mode() 163 writel(tmp, vtg->regs + VTG_TOP_V_VD_2); vtg_set_mode() 164 writel(tmp, vtg->regs + VTG_BOT_V_VD_2); vtg_set_mode() 165 writel(0, vtg->regs + VTG_TOP_V_HD_2); vtg_set_mode() 166 writel(0, vtg->regs + VTG_BOT_V_HD_2); vtg_set_mode() 171 writel(tmp, vtg->regs + VTG_H_HD_3); vtg_set_mode() 175 writel(tmp, vtg->regs + VTG_TOP_V_VD_3); vtg_set_mode() 176 writel(tmp, vtg->regs + VTG_BOT_V_VD_3); vtg_set_mode() 180 writel(tmp, vtg->regs + VTG_TOP_V_HD_3); vtg_set_mode() 181 writel(tmp, vtg->regs + VTG_BOT_V_HD_3); vtg_set_mode() 185 writel(tmp, vtg->regs + VTG_H_HD_4); vtg_set_mode() 189 writel(tmp, vtg->regs + VTG_TOP_V_VD_4); vtg_set_mode() 190 writel(tmp, vtg->regs + VTG_BOT_V_VD_4); vtg_set_mode() 191 writel(0, vtg->regs + VTG_TOP_V_HD_4); vtg_set_mode() 192 writel(0, vtg->regs + VTG_BOT_V_HD_4); vtg_set_mode() 195 writel(type, vtg->regs + VTG_MODE); vtg_set_mode() 198 static void vtg_enable_irq(struct sti_vtg *vtg) vtg_enable_irq() argument 201 writel(0xFFFF, vtg->regs + VTG_HOST_ITS_BCLR); vtg_enable_irq() 202 writel(0xFFFF, vtg->regs + VTG_HOST_ITM_BCLR); vtg_enable_irq() 203 writel(VTG_IRQ_MASK, vtg->regs + VTG_HOST_ITM_BSET); vtg_enable_irq() 206 void sti_vtg_set_config(struct sti_vtg *vtg, sti_vtg_set_config() argument 210 vtg_set_mode(vtg, VTG_TYPE_MASTER, mode); sti_vtg_set_config() 212 vtg_reset(vtg); sti_vtg_set_config() 214 /* enable irq for the vtg vblank synchro */ sti_vtg_set_config() 215 if (vtg->slave) sti_vtg_set_config() 216 vtg_enable_irq(vtg->slave); sti_vtg_set_config() 218 vtg_enable_irq(vtg); sti_vtg_set_config() 261 int sti_vtg_register_client(struct sti_vtg *vtg, sti_vtg_register_client() argument 264 if (vtg->slave) sti_vtg_register_client() 265 return sti_vtg_register_client(vtg->slave, nb, crtc_id); sti_vtg_register_client() 267 vtg->crtc_id = crtc_id; sti_vtg_register_client() 268 return raw_notifier_chain_register(&vtg->notifier_list, nb); sti_vtg_register_client() 272 int sti_vtg_unregister_client(struct sti_vtg *vtg, struct notifier_block *nb) sti_vtg_unregister_client() argument 274 if (vtg->slave) sti_vtg_unregister_client() 275 return sti_vtg_unregister_client(vtg->slave, nb); sti_vtg_unregister_client() 277 return raw_notifier_chain_unregister(&vtg->notifier_list, nb); sti_vtg_unregister_client() 283 struct sti_vtg *vtg = arg; vtg_irq_thread() local 286 event = (vtg->irq_status & VTG_IRQ_TOP) ? vtg_irq_thread() 289 raw_notifier_call_chain(&vtg->notifier_list, event, &vtg->crtc_id); vtg_irq_thread() 296 struct sti_vtg *vtg = arg; vtg_irq() local 298 vtg->irq_status = readl(vtg->regs + VTG_HOST_ITS); vtg_irq() 300 writel(vtg->irq_status, vtg->regs + VTG_HOST_ITS_BCLR); vtg_irq() 303 readl(vtg->regs + VTG_HOST_ITS); vtg_irq() 312 struct sti_vtg *vtg; vtg_probe() local 317 vtg = devm_kzalloc(dev, sizeof(*vtg), GFP_KERNEL); vtg_probe() 318 if (!vtg) vtg_probe() 321 vtg->dev = dev; vtg_probe() 322 vtg->np = pdev->dev.of_node; vtg_probe() 330 vtg->regs = devm_ioremap_nocache(dev, res->start, resource_size(res)); vtg_probe() 334 vtg->slave = of_vtg_find(np); vtg_probe() 336 if (!vtg->slave) vtg_probe() 339 vtg->irq = platform_get_irq(pdev, 0); vtg_probe() 340 if (IS_ERR_VALUE(vtg->irq)) { vtg_probe() 342 return vtg->irq; vtg_probe() 346 dev_name(vtg->dev)); vtg_probe() 348 RAW_INIT_NOTIFIER_HEAD(&vtg->notifier_list); vtg_probe() 350 ret = devm_request_threaded_irq(dev, vtg->irq, vtg_irq, vtg_probe() 351 vtg_irq_thread, IRQF_ONESHOT, irq_name, vtg); vtg_probe() 358 vtg_register(vtg); vtg_probe() 359 platform_set_drvdata(pdev, vtg); vtg_probe() 361 DRM_INFO("%s %s\n", __func__, dev_name(vtg->dev)); vtg_probe() 372 { .compatible = "st,vtg", }, 379 .name = "sti-vtg",
|