Lines Matching refs:isc
197 static void isc_sama5d2_config_csc(struct isc_device *isc) in isc_sama5d2_config_csc() argument
199 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_csc()
202 regmap_write(regmap, ISC_CSC_YR_YG + isc->offsets.csc, in isc_sama5d2_config_csc()
204 regmap_write(regmap, ISC_CSC_YB_OY + isc->offsets.csc, in isc_sama5d2_config_csc()
206 regmap_write(regmap, ISC_CSC_CBR_CBG + isc->offsets.csc, in isc_sama5d2_config_csc()
208 regmap_write(regmap, ISC_CSC_CBB_OCB + isc->offsets.csc, in isc_sama5d2_config_csc()
210 regmap_write(regmap, ISC_CSC_CRR_CRG + isc->offsets.csc, in isc_sama5d2_config_csc()
212 regmap_write(regmap, ISC_CSC_CRB_OCR + isc->offsets.csc, in isc_sama5d2_config_csc()
216 static void isc_sama5d2_config_cbc(struct isc_device *isc) in isc_sama5d2_config_cbc() argument
218 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_cbc()
220 regmap_write(regmap, ISC_CBC_BRIGHT + isc->offsets.cbc, in isc_sama5d2_config_cbc()
221 isc->ctrls.brightness); in isc_sama5d2_config_cbc()
222 regmap_write(regmap, ISC_CBC_CONTRAST + isc->offsets.cbc, in isc_sama5d2_config_cbc()
223 isc->ctrls.contrast); in isc_sama5d2_config_cbc()
226 static void isc_sama5d2_config_cc(struct isc_device *isc) in isc_sama5d2_config_cc() argument
228 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_cc()
239 static void isc_sama5d2_config_ctrls(struct isc_device *isc, in isc_sama5d2_config_ctrls() argument
242 struct isc_ctrls *ctrls = &isc->ctrls; in isc_sama5d2_config_ctrls()
250 static void isc_sama5d2_config_dpc(struct isc_device *isc) in isc_sama5d2_config_dpc() argument
255 static void isc_sama5d2_config_gam(struct isc_device *isc) in isc_sama5d2_config_gam() argument
260 static void isc_sama5d2_config_rlp(struct isc_device *isc) in isc_sama5d2_config_rlp() argument
262 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_rlp()
263 u32 rlp_mode = isc->config.rlp_cfg_mode; in isc_sama5d2_config_rlp()
282 regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp, in isc_sama5d2_config_rlp()
286 static void isc_sama5d2_adapt_pipeline(struct isc_device *isc) in isc_sama5d2_adapt_pipeline() argument
288 isc->try_config.bits_pipeline &= ISC_SAMA5D2_PIPELINE; in isc_sama5d2_adapt_pipeline()
333 static int isc_parse_dt(struct device *dev, struct isc_device *isc) in isc_parse_dt() argument
341 INIT_LIST_HEAD(&isc->subdev_entities); in isc_parse_dt()
381 list_add_tail(&subdev_entity->list, &isc->subdev_entities); in isc_parse_dt()
391 struct isc_device *isc; in atmel_isc_probe() local
399 isc = devm_kzalloc(dev, sizeof(*isc), GFP_KERNEL); in atmel_isc_probe()
400 if (!isc) in atmel_isc_probe()
403 platform_set_drvdata(pdev, isc); in atmel_isc_probe()
404 isc->dev = dev; in atmel_isc_probe()
411 isc->regmap = devm_regmap_init_mmio(dev, io_base, &isc_regmap_config); in atmel_isc_probe()
412 if (IS_ERR(isc->regmap)) { in atmel_isc_probe()
413 ret = PTR_ERR(isc->regmap); in atmel_isc_probe()
423 "atmel-sama5d2-isc", isc); in atmel_isc_probe()
430 isc->gamma_table = isc_sama5d2_gamma_table; in atmel_isc_probe()
431 isc->gamma_max = 2; in atmel_isc_probe()
433 isc->max_width = ISC_SAMA5D2_MAX_SUPPORT_WIDTH; in atmel_isc_probe()
434 isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT; in atmel_isc_probe()
436 isc->config_dpc = isc_sama5d2_config_dpc; in atmel_isc_probe()
437 isc->config_csc = isc_sama5d2_config_csc; in atmel_isc_probe()
438 isc->config_cbc = isc_sama5d2_config_cbc; in atmel_isc_probe()
439 isc->config_cc = isc_sama5d2_config_cc; in atmel_isc_probe()
440 isc->config_gam = isc_sama5d2_config_gam; in atmel_isc_probe()
441 isc->config_rlp = isc_sama5d2_config_rlp; in atmel_isc_probe()
442 isc->config_ctrls = isc_sama5d2_config_ctrls; in atmel_isc_probe()
444 isc->adapt_pipeline = isc_sama5d2_adapt_pipeline; in atmel_isc_probe()
446 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET; in atmel_isc_probe()
447 isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET; in atmel_isc_probe()
448 isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET; in atmel_isc_probe()
449 isc->offsets.sub420 = ISC_SAMA5D2_SUB420_OFFSET; in atmel_isc_probe()
450 isc->offsets.rlp = ISC_SAMA5D2_RLP_OFFSET; in atmel_isc_probe()
451 isc->offsets.his = ISC_SAMA5D2_HIS_OFFSET; in atmel_isc_probe()
452 isc->offsets.dma = ISC_SAMA5D2_DMA_OFFSET; in atmel_isc_probe()
453 isc->offsets.version = ISC_SAMA5D2_VERSION_OFFSET; in atmel_isc_probe()
454 isc->offsets.his_entry = ISC_SAMA5D2_HIS_ENTRY_OFFSET; in atmel_isc_probe()
456 isc->controller_formats = sama5d2_controller_formats; in atmel_isc_probe()
457 isc->controller_formats_size = ARRAY_SIZE(sama5d2_controller_formats); in atmel_isc_probe()
458 isc->formats_list = sama5d2_formats_list; in atmel_isc_probe()
459 isc->formats_list_size = ARRAY_SIZE(sama5d2_formats_list); in atmel_isc_probe()
462 isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8; in atmel_isc_probe()
465 isc->ispck_required = true; in atmel_isc_probe()
467 ret = isc_pipeline_init(isc); in atmel_isc_probe()
471 isc->hclock = devm_clk_get(dev, "hclock"); in atmel_isc_probe()
472 if (IS_ERR(isc->hclock)) { in atmel_isc_probe()
473 ret = PTR_ERR(isc->hclock); in atmel_isc_probe()
478 ret = clk_prepare_enable(isc->hclock); in atmel_isc_probe()
484 ret = isc_clk_init(isc); in atmel_isc_probe()
489 ret = v4l2_device_register(dev, &isc->v4l2_dev); in atmel_isc_probe()
495 ret = isc_parse_dt(dev, isc); in atmel_isc_probe()
501 if (list_empty(&isc->subdev_entities)) { in atmel_isc_probe()
507 list_for_each_entry(subdev_entity, &isc->subdev_entities, list) { in atmel_isc_probe()
528 ret = v4l2_async_nf_register(&isc->v4l2_dev, in atmel_isc_probe()
535 if (video_is_registered(&isc->video_dev)) in atmel_isc_probe()
543 isc->ispck = isc->isc_clks[ISC_ISPCK].clk; in atmel_isc_probe()
545 ret = clk_prepare_enable(isc->ispck); in atmel_isc_probe()
552 ret = clk_set_rate(isc->ispck, clk_get_rate(isc->hclock)); in atmel_isc_probe()
558 regmap_read(isc->regmap, ISC_VERSION + isc->offsets.version, &ver); in atmel_isc_probe()
564 clk_disable_unprepare(isc->ispck); in atmel_isc_probe()
570 isc_subdev_cleanup(isc); in atmel_isc_probe()
573 v4l2_device_unregister(&isc->v4l2_dev); in atmel_isc_probe()
576 clk_disable_unprepare(isc->hclock); in atmel_isc_probe()
578 isc_clk_cleanup(isc); in atmel_isc_probe()
585 struct isc_device *isc = platform_get_drvdata(pdev); in atmel_isc_remove() local
589 isc_subdev_cleanup(isc); in atmel_isc_remove()
591 v4l2_device_unregister(&isc->v4l2_dev); in atmel_isc_remove()
593 clk_disable_unprepare(isc->ispck); in atmel_isc_remove()
594 clk_disable_unprepare(isc->hclock); in atmel_isc_remove()
596 isc_clk_cleanup(isc); in atmel_isc_remove()
603 struct isc_device *isc = dev_get_drvdata(dev); in isc_runtime_suspend() local
605 clk_disable_unprepare(isc->ispck); in isc_runtime_suspend()
606 clk_disable_unprepare(isc->hclock); in isc_runtime_suspend()
613 struct isc_device *isc = dev_get_drvdata(dev); in isc_runtime_resume() local
616 ret = clk_prepare_enable(isc->hclock); in isc_runtime_resume()
620 ret = clk_prepare_enable(isc->ispck); in isc_runtime_resume()
622 clk_disable_unprepare(isc->hclock); in isc_runtime_resume()