• Home
  • Raw
  • Download

Lines Matching refs:vga

50 	struct zx_vga *vga = to_zx_vga(encoder);  in zx_vga_encoder_enable()  local
51 struct zx_vga_pwrctrl *pwrctrl = &vga->pwrctrl; in zx_vga_encoder_enable()
62 struct zx_vga *vga = to_zx_vga(encoder); in zx_vga_encoder_disable() local
63 struct zx_vga_pwrctrl *pwrctrl = &vga->pwrctrl; in zx_vga_encoder_disable()
78 struct zx_vga *vga = to_zx_vga(connector); in zx_vga_connector_get_modes() local
86 zx_writel(vga->mmio + VGA_AUTO_DETECT_SEL, 0); in zx_vga_connector_get_modes()
88 edid = drm_get_edid(connector, &vga->ddc->adap); in zx_vga_connector_get_modes()
96 zx_writel(vga->mmio + VGA_AUTO_DETECT_SEL, in zx_vga_connector_get_modes()
98 vga->connected = false; in zx_vga_connector_get_modes()
106 zx_writel(vga->mmio + VGA_AUTO_DETECT_SEL, VGA_DETECT_SEL_HAS_DEVICE); in zx_vga_connector_get_modes()
130 struct zx_vga *vga = to_zx_vga(connector); in zx_vga_connector_detect() local
132 return vga->connected ? connector_status_connected : in zx_vga_connector_detect()
145 static int zx_vga_register(struct drm_device *drm, struct zx_vga *vga) in zx_vga_register() argument
147 struct drm_encoder *encoder = &vga->encoder; in zx_vga_register()
148 struct drm_connector *connector = &vga->connector; in zx_vga_register()
149 struct device *dev = vga->dev; in zx_vga_register()
162 vga->connector.polled = DRM_CONNECTOR_POLL_HPD; in zx_vga_register()
167 &vga->ddc->adap); in zx_vga_register()
190 static int zx_vga_pwrctrl_init(struct zx_vga *vga) in zx_vga_pwrctrl_init() argument
192 struct zx_vga_pwrctrl *pwrctrl = &vga->pwrctrl; in zx_vga_pwrctrl_init()
193 struct device *dev = vga->dev; in zx_vga_pwrctrl_init()
218 static int zx_vga_i2c_read(struct zx_vga *vga, struct i2c_msg *msg) in zx_vga_i2c_read() argument
225 reinit_completion(&vga->complete); in zx_vga_i2c_read()
228 zx_writel_mask(vga->mmio + VGA_CMD_CFG, VGA_CMD_COMBO, VGA_CMD_COMBO); in zx_vga_i2c_read()
229 zx_writel_mask(vga->mmio + VGA_CMD_CFG, VGA_CMD_RW, 0); in zx_vga_i2c_read()
235 zx_writel_mask(vga->mmio + VGA_RXF_CTRL, VGA_RX_FIFO_CLEAR, in zx_vga_i2c_read()
239 zx_writel(vga->mmio + VGA_SUB_ADDR, offset); in zx_vga_i2c_read()
242 zx_writel_mask(vga->mmio + VGA_CMD_CFG, VGA_CMD_TRANS, in zx_vga_i2c_read()
245 if (!wait_for_completion_timeout(&vga->complete, in zx_vga_i2c_read()
247 DRM_DEV_ERROR(vga->dev, "transfer timeout\n"); in zx_vga_i2c_read()
251 cnt = zx_readl(vga->mmio + VGA_RXF_STATUS); in zx_vga_i2c_read()
257 *buf++ = zx_readl(vga->mmio + VGA_DATA); in zx_vga_i2c_read()
266 static int zx_vga_i2c_write(struct zx_vga *vga, struct i2c_msg *msg) in zx_vga_i2c_write() argument
276 zx_writel(vga->mmio + VGA_DEVICE_ADDR, msg->addr); in zx_vga_i2c_write()
284 struct zx_vga *vga = i2c_get_adapdata(adap); in zx_vga_i2c_xfer() local
285 struct zx_vga_i2c *ddc = vga->ddc; in zx_vga_i2c_xfer()
293 ret = zx_vga_i2c_read(vga, &msgs[i]); in zx_vga_i2c_xfer()
295 ret = zx_vga_i2c_write(vga, &msgs[i]); in zx_vga_i2c_xfer()
319 static int zx_vga_ddc_register(struct zx_vga *vga) in zx_vga_ddc_register() argument
321 struct device *dev = vga->dev; in zx_vga_ddc_register()
330 vga->ddc = ddc; in zx_vga_ddc_register()
346 i2c_set_adapdata(adap, vga); in zx_vga_ddc_register()
353 struct zx_vga *vga = dev_id; in zx_vga_irq_thread() local
355 drm_helper_hpd_irq_event(vga->connector.dev); in zx_vga_irq_thread()
362 struct zx_vga *vga = dev_id; in zx_vga_irq_handler() local
365 status = zx_readl(vga->mmio + VGA_I2C_STATUS); in zx_vga_irq_handler()
368 zx_writel_mask(vga->mmio + VGA_I2C_STATUS, VGA_CLEAR_IRQ, in zx_vga_irq_handler()
378 vga->connected = true; in zx_vga_irq_handler()
383 zx_writel(vga->mmio + VGA_AUTO_DETECT_SEL, in zx_vga_irq_handler()
385 vga->connected = false; in zx_vga_irq_handler()
390 complete(&vga->complete); in zx_vga_irq_handler()
397 static void zx_vga_hw_init(struct zx_vga *vga) in zx_vga_hw_init() argument
399 unsigned long ref = clk_get_rate(vga->i2c_wclk); in zx_vga_hw_init()
407 zx_writel(vga->mmio + VGA_CLK_DIV_FS, div); in zx_vga_hw_init()
410 zx_writel(vga->mmio + VGA_AUTO_DETECT_PARA, 0x80); in zx_vga_hw_init()
411 zx_writel(vga->mmio + VGA_AUTO_DETECT_SEL, VGA_DETECT_SEL_NO_DEVICE); in zx_vga_hw_init()
417 zx_writel(vga->mmio + VGA_DEVICE_ADDR, DDC_ADDR); in zx_vga_hw_init()
418 zx_writel_mask(vga->mmio + VGA_CMD_CFG, VGA_CMD_TRANS, VGA_CMD_TRANS); in zx_vga_hw_init()
426 struct zx_vga *vga; in zx_vga_bind() local
430 vga = devm_kzalloc(dev, sizeof(*vga), GFP_KERNEL); in zx_vga_bind()
431 if (!vga) in zx_vga_bind()
434 vga->dev = dev; in zx_vga_bind()
435 dev_set_drvdata(dev, vga); in zx_vga_bind()
438 vga->mmio = devm_ioremap_resource(dev, res); in zx_vga_bind()
439 if (IS_ERR(vga->mmio)) in zx_vga_bind()
440 return PTR_ERR(vga->mmio); in zx_vga_bind()
446 vga->i2c_wclk = devm_clk_get(dev, "i2c_wclk"); in zx_vga_bind()
447 if (IS_ERR(vga->i2c_wclk)) { in zx_vga_bind()
448 ret = PTR_ERR(vga->i2c_wclk); in zx_vga_bind()
453 ret = zx_vga_pwrctrl_init(vga); in zx_vga_bind()
459 ret = zx_vga_ddc_register(vga); in zx_vga_bind()
465 ret = zx_vga_register(drm, vga); in zx_vga_bind()
471 init_completion(&vga->complete); in zx_vga_bind()
475 dev_name(dev), vga); in zx_vga_bind()
481 ret = clk_prepare_enable(vga->i2c_wclk); in zx_vga_bind()
485 zx_vga_hw_init(vga); in zx_vga_bind()
493 struct zx_vga *vga = dev_get_drvdata(dev); in zx_vga_unbind() local
495 clk_disable_unprepare(vga->i2c_wclk); in zx_vga_unbind()