Lines Matching refs:sdev
76 void sdo_write_mask(struct sdo_device *sdev, u32 reg_id, u32 value, u32 mask) in sdo_write_mask() argument
78 u32 old = readl(sdev->regs + reg_id); in sdo_write_mask()
80 writel(value, sdev->regs + reg_id); in sdo_write_mask()
84 void sdo_write(struct sdo_device *sdev, u32 reg_id, u32 value) in sdo_write() argument
86 writel(value, sdev->regs + reg_id); in sdo_write()
90 u32 sdo_read(struct sdo_device *sdev, u32 reg_id) in sdo_read() argument
92 return readl(sdev->regs + reg_id); in sdo_read()
97 struct sdo_device *sdev = dev_data; in sdo_irq_handler() local
100 sdo_write_mask(sdev, SDO_IRQ, ~0, SDO_VSYNC_IRQ_PEND); in sdo_irq_handler()
104 static void sdo_reg_debug(struct sdo_device *sdev) in sdo_reg_debug() argument
107 dev_info(sdev->dev, #reg_id " = %08x\n", \ in sdo_reg_debug()
108 sdo_read(sdev, reg_id)) in sdo_reg_debug()
148 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_s_std_output() local
153 sdev->fmt = fmt; in sdo_s_std_output()
168 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_get_fmt() local
170 if (!sdev->fmt) in sdo_get_fmt()
176 fmt->height = sdev->fmt->height; in sdo_get_fmt()
185 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_s_power() local
186 struct device *dev = sdev->dev; in sdo_s_power()
200 static int sdo_streamon(struct sdo_device *sdev) in sdo_streamon() argument
205 sdev->vpll_rate = clk_get_rate(sdev->fout_vpll); in sdo_streamon()
206 ret = clk_set_rate(sdev->fout_vpll, 54000000); in sdo_streamon()
208 dev_err(sdev->dev, "Failed to set vpll rate\n"); in sdo_streamon()
211 dev_info(sdev->dev, "fout_vpll.rate = %lu\n", in sdo_streamon()
212 clk_get_rate(sdev->fout_vpll)); in sdo_streamon()
214 sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON); in sdo_streamon()
215 ret = clk_prepare_enable(sdev->dacphy); in sdo_streamon()
217 dev_err(sdev->dev, "clk_prepare_enable(dacphy) failed\n"); in sdo_streamon()
221 sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC); in sdo_streamon()
222 sdo_reg_debug(sdev); in sdo_streamon()
226 sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); in sdo_streamon()
227 clk_set_rate(sdev->fout_vpll, sdev->vpll_rate); in sdo_streamon()
231 static int sdo_streamoff(struct sdo_device *sdev) in sdo_streamoff() argument
235 sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); in sdo_streamoff()
236 clk_disable_unprepare(sdev->dacphy); in sdo_streamoff()
237 sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); in sdo_streamoff()
239 if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) in sdo_streamoff()
244 dev_err(sdev->dev, "failed to stop streaming\n"); in sdo_streamoff()
245 clk_set_rate(sdev->fout_vpll, sdev->vpll_rate); in sdo_streamoff()
251 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_s_stream() local
252 return on ? sdo_streamon(sdev) : sdo_streamoff(sdev); in sdo_s_stream()
279 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_runtime_suspend() local
282 regulator_disable(sdev->vdet); in sdo_runtime_suspend()
283 regulator_disable(sdev->vdac); in sdo_runtime_suspend()
284 clk_disable_unprepare(sdev->sclk_dac); in sdo_runtime_suspend()
291 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_runtime_resume() local
296 ret = clk_prepare_enable(sdev->sclk_dac); in sdo_runtime_resume()
300 ret = regulator_enable(sdev->vdac); in sdo_runtime_resume()
304 ret = regulator_enable(sdev->vdet); in sdo_runtime_resume()
309 sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_SW_RESET); in sdo_runtime_resume()
311 sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_SW_RESET); in sdo_runtime_resume()
314 sdo_write_mask(sdev, SDO_CONFIG, sdev->fmt->cookie, SDO_STANDARD_MASK); in sdo_runtime_resume()
316 sdo_write_mask(sdev, SDO_CONFIG, 0, SDO_PROGRESSIVE); in sdo_runtime_resume()
318 sdo_write_mask(sdev, SDO_VBI, 0, SDO_CVBS_WSS_INS | in sdo_runtime_resume()
321 sdo_write_mask(sdev, SDO_CCCON, ~0, SDO_COMPENSATION_BHS_ADJ_OFF | in sdo_runtime_resume()
323 sdo_reg_debug(sdev); in sdo_runtime_resume()
327 regulator_disable(sdev->vdac); in sdo_runtime_resume()
329 clk_disable_unprepare(sdev->sclk_dac); in sdo_runtime_resume()
341 struct sdo_device *sdev; in sdo_probe() local
347 sdev = devm_kzalloc(&pdev->dev, sizeof(*sdev), GFP_KERNEL); in sdo_probe()
348 if (!sdev) { in sdo_probe()
353 sdev->dev = dev; in sdo_probe()
363 sdev->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); in sdo_probe()
364 if (sdev->regs == NULL) { in sdo_probe()
378 "s5p-sdo", sdev); in sdo_probe()
383 sdev->irq = res->start; in sdo_probe()
386 sdev->sclk_dac = clk_get(dev, "sclk_dac"); in sdo_probe()
387 if (IS_ERR(sdev->sclk_dac)) { in sdo_probe()
389 ret = PTR_ERR(sdev->sclk_dac); in sdo_probe()
392 sdev->dac = clk_get(dev, "dac"); in sdo_probe()
393 if (IS_ERR(sdev->dac)) { in sdo_probe()
395 ret = PTR_ERR(sdev->dac); in sdo_probe()
398 sdev->dacphy = clk_get(dev, "dacphy"); in sdo_probe()
399 if (IS_ERR(sdev->dacphy)) { in sdo_probe()
401 ret = PTR_ERR(sdev->dacphy); in sdo_probe()
410 clk_set_parent(sdev->sclk_dac, sclk_vpll); in sdo_probe()
412 sdev->fout_vpll = clk_get(dev, "fout_vpll"); in sdo_probe()
413 if (IS_ERR(sdev->fout_vpll)) { in sdo_probe()
415 ret = PTR_ERR(sdev->fout_vpll); in sdo_probe()
421 sdev->vdac = devm_regulator_get(dev, "vdd33a_dac"); in sdo_probe()
422 if (IS_ERR(sdev->vdac)) { in sdo_probe()
424 ret = PTR_ERR(sdev->vdac); in sdo_probe()
427 sdev->vdet = devm_regulator_get(dev, "vdet"); in sdo_probe()
428 if (IS_ERR(sdev->vdet)) { in sdo_probe()
430 ret = PTR_ERR(sdev->vdet); in sdo_probe()
435 ret = clk_prepare_enable(sdev->dac); in sdo_probe()
445 v4l2_subdev_init(&sdev->sd, &sdo_sd_ops); in sdo_probe()
446 sdev->sd.owner = THIS_MODULE; in sdo_probe()
447 strlcpy(sdev->sd.name, "s5p-sdo", sizeof(sdev->sd.name)); in sdo_probe()
450 sdev->fmt = sdo_find_format(SDO_DEFAULT_STD); in sdo_probe()
451 BUG_ON(sdev->fmt == NULL); in sdo_probe()
454 dev_set_drvdata(dev, &sdev->sd); in sdo_probe()
460 clk_put(sdev->fout_vpll); in sdo_probe()
462 clk_put(sdev->dacphy); in sdo_probe()
464 clk_put(sdev->dac); in sdo_probe()
466 clk_put(sdev->sclk_dac); in sdo_probe()
475 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_remove() local
478 clk_disable_unprepare(sdev->dac); in sdo_remove()
479 clk_put(sdev->fout_vpll); in sdo_remove()
480 clk_put(sdev->dacphy); in sdo_remove()
481 clk_put(sdev->dac); in sdo_remove()
482 clk_put(sdev->sclk_dac); in sdo_remove()