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()
166 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_g_mbus_fmt() local
168 if (!sdev->fmt) in sdo_g_mbus_fmt()
172 fmt->height = sdev->fmt->height; in sdo_g_mbus_fmt()
181 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_s_power() local
182 struct device *dev = sdev->dev; in sdo_s_power()
196 static int sdo_streamon(struct sdo_device *sdev) in sdo_streamon() argument
201 sdev->vpll_rate = clk_get_rate(sdev->fout_vpll); in sdo_streamon()
202 ret = clk_set_rate(sdev->fout_vpll, 54000000); in sdo_streamon()
204 dev_err(sdev->dev, "Failed to set vpll rate\n"); in sdo_streamon()
207 dev_info(sdev->dev, "fout_vpll.rate = %lu\n", in sdo_streamon()
208 clk_get_rate(sdev->fout_vpll)); in sdo_streamon()
210 sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON); in sdo_streamon()
211 ret = clk_prepare_enable(sdev->dacphy); in sdo_streamon()
213 dev_err(sdev->dev, "clk_prepare_enable(dacphy) failed\n"); in sdo_streamon()
217 sdo_write_mask(sdev, SDO_DAC, ~0, SDO_POWER_ON_DAC); in sdo_streamon()
218 sdo_reg_debug(sdev); in sdo_streamon()
222 sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); in sdo_streamon()
223 clk_set_rate(sdev->fout_vpll, sdev->vpll_rate); in sdo_streamon()
227 static int sdo_streamoff(struct sdo_device *sdev) in sdo_streamoff() argument
231 sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); in sdo_streamoff()
232 clk_disable_unprepare(sdev->dacphy); in sdo_streamoff()
233 sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); in sdo_streamoff()
235 if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) in sdo_streamoff()
240 dev_err(sdev->dev, "failed to stop streaming\n"); in sdo_streamoff()
241 clk_set_rate(sdev->fout_vpll, sdev->vpll_rate); in sdo_streamoff()
247 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_s_stream() local
248 return on ? sdo_streamon(sdev) : sdo_streamoff(sdev); in sdo_s_stream()
271 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_runtime_suspend() local
274 regulator_disable(sdev->vdet); in sdo_runtime_suspend()
275 regulator_disable(sdev->vdac); in sdo_runtime_suspend()
276 clk_disable_unprepare(sdev->sclk_dac); in sdo_runtime_suspend()
283 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_runtime_resume() local
288 ret = clk_prepare_enable(sdev->sclk_dac); in sdo_runtime_resume()
292 ret = regulator_enable(sdev->vdac); in sdo_runtime_resume()
296 ret = regulator_enable(sdev->vdet); in sdo_runtime_resume()
301 sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_SW_RESET); in sdo_runtime_resume()
303 sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_SW_RESET); in sdo_runtime_resume()
306 sdo_write_mask(sdev, SDO_CONFIG, sdev->fmt->cookie, SDO_STANDARD_MASK); in sdo_runtime_resume()
308 sdo_write_mask(sdev, SDO_CONFIG, 0, SDO_PROGRESSIVE); in sdo_runtime_resume()
310 sdo_write_mask(sdev, SDO_VBI, 0, SDO_CVBS_WSS_INS | in sdo_runtime_resume()
313 sdo_write_mask(sdev, SDO_CCCON, ~0, SDO_COMPENSATION_BHS_ADJ_OFF | in sdo_runtime_resume()
315 sdo_reg_debug(sdev); in sdo_runtime_resume()
319 regulator_disable(sdev->vdac); in sdo_runtime_resume()
321 clk_disable_unprepare(sdev->sclk_dac); in sdo_runtime_resume()
333 struct sdo_device *sdev; in sdo_probe() local
339 sdev = devm_kzalloc(&pdev->dev, sizeof(*sdev), GFP_KERNEL); in sdo_probe()
340 if (!sdev) { in sdo_probe()
345 sdev->dev = dev; in sdo_probe()
355 sdev->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); in sdo_probe()
356 if (sdev->regs == NULL) { in sdo_probe()
370 "s5p-sdo", sdev); in sdo_probe()
375 sdev->irq = res->start; in sdo_probe()
378 sdev->sclk_dac = clk_get(dev, "sclk_dac"); in sdo_probe()
379 if (IS_ERR(sdev->sclk_dac)) { in sdo_probe()
381 ret = PTR_ERR(sdev->sclk_dac); in sdo_probe()
384 sdev->dac = clk_get(dev, "dac"); in sdo_probe()
385 if (IS_ERR(sdev->dac)) { in sdo_probe()
387 ret = PTR_ERR(sdev->dac); in sdo_probe()
390 sdev->dacphy = clk_get(dev, "dacphy"); in sdo_probe()
391 if (IS_ERR(sdev->dacphy)) { in sdo_probe()
393 ret = PTR_ERR(sdev->dacphy); in sdo_probe()
402 clk_set_parent(sdev->sclk_dac, sclk_vpll); in sdo_probe()
404 sdev->fout_vpll = clk_get(dev, "fout_vpll"); in sdo_probe()
405 if (IS_ERR(sdev->fout_vpll)) { in sdo_probe()
407 ret = PTR_ERR(sdev->fout_vpll); in sdo_probe()
413 sdev->vdac = devm_regulator_get(dev, "vdd33a_dac"); in sdo_probe()
414 if (IS_ERR(sdev->vdac)) { in sdo_probe()
416 ret = PTR_ERR(sdev->vdac); in sdo_probe()
419 sdev->vdet = devm_regulator_get(dev, "vdet"); in sdo_probe()
420 if (IS_ERR(sdev->vdet)) { in sdo_probe()
422 ret = PTR_ERR(sdev->vdet); in sdo_probe()
427 ret = clk_prepare_enable(sdev->dac); in sdo_probe()
437 v4l2_subdev_init(&sdev->sd, &sdo_sd_ops); in sdo_probe()
438 sdev->sd.owner = THIS_MODULE; in sdo_probe()
439 strlcpy(sdev->sd.name, "s5p-sdo", sizeof(sdev->sd.name)); in sdo_probe()
442 sdev->fmt = sdo_find_format(SDO_DEFAULT_STD); in sdo_probe()
443 BUG_ON(sdev->fmt == NULL); in sdo_probe()
446 dev_set_drvdata(dev, &sdev->sd); in sdo_probe()
452 clk_put(sdev->fout_vpll); in sdo_probe()
454 clk_put(sdev->dacphy); in sdo_probe()
456 clk_put(sdev->dac); in sdo_probe()
458 clk_put(sdev->sclk_dac); in sdo_probe()
467 struct sdo_device *sdev = sd_to_sdev(sd); in sdo_remove() local
470 clk_disable_unprepare(sdev->dac); in sdo_remove()
471 clk_put(sdev->fout_vpll); in sdo_remove()
472 clk_put(sdev->dacphy); in sdo_remove()
473 clk_put(sdev->dac); in sdo_remove()
474 clk_put(sdev->sclk_dac); in sdo_remove()