Lines Matching full:isc

3  * Microchip Image Sensor Controller (ISC) driver
13 * ISC video pipeline integrates the following submodules:
49 #include "microchip-isc-regs.h"
50 #include "microchip-isc.h"
59 /* This is a list of the formats that the ISC can *output* */
120 /* This is a list of formats that the ISC can receive as *input* */
217 static void isc_sama5d2_config_csc(struct isc_device *isc) in isc_sama5d2_config_csc() argument
219 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_csc()
222 regmap_write(regmap, ISC_CSC_YR_YG + isc->offsets.csc, in isc_sama5d2_config_csc()
224 regmap_write(regmap, ISC_CSC_YB_OY + isc->offsets.csc, in isc_sama5d2_config_csc()
226 regmap_write(regmap, ISC_CSC_CBR_CBG + isc->offsets.csc, in isc_sama5d2_config_csc()
228 regmap_write(regmap, ISC_CSC_CBB_OCB + isc->offsets.csc, in isc_sama5d2_config_csc()
230 regmap_write(regmap, ISC_CSC_CRR_CRG + isc->offsets.csc, in isc_sama5d2_config_csc()
232 regmap_write(regmap, ISC_CSC_CRB_OCR + isc->offsets.csc, in isc_sama5d2_config_csc()
236 static void isc_sama5d2_config_cbc(struct isc_device *isc) in isc_sama5d2_config_cbc() argument
238 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_cbc()
240 regmap_write(regmap, ISC_CBC_BRIGHT + isc->offsets.cbc, in isc_sama5d2_config_cbc()
241 isc->ctrls.brightness); in isc_sama5d2_config_cbc()
242 regmap_write(regmap, ISC_CBC_CONTRAST + isc->offsets.cbc, in isc_sama5d2_config_cbc()
243 isc->ctrls.contrast); in isc_sama5d2_config_cbc()
246 static void isc_sama5d2_config_cc(struct isc_device *isc) in isc_sama5d2_config_cc() argument
248 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_cc()
259 static void isc_sama5d2_config_ctrls(struct isc_device *isc, in isc_sama5d2_config_ctrls() argument
262 struct isc_ctrls *ctrls = &isc->ctrls; in isc_sama5d2_config_ctrls()
270 static void isc_sama5d2_config_dpc(struct isc_device *isc) in isc_sama5d2_config_dpc() argument
275 static void isc_sama5d2_config_gam(struct isc_device *isc) in isc_sama5d2_config_gam() argument
280 static void isc_sama5d2_config_rlp(struct isc_device *isc) in isc_sama5d2_config_rlp() argument
282 struct regmap *regmap = isc->regmap; in isc_sama5d2_config_rlp()
283 u32 rlp_mode = isc->config.rlp_cfg_mode; in isc_sama5d2_config_rlp()
302 regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp, in isc_sama5d2_config_rlp()
306 static void isc_sama5d2_adapt_pipeline(struct isc_device *isc) in isc_sama5d2_adapt_pipeline() argument
308 isc->try_config.bits_pipeline &= ISC_SAMA5D2_PIPELINE; in isc_sama5d2_adapt_pipeline()
353 static int isc_parse_dt(struct device *dev, struct isc_device *isc) in isc_parse_dt() argument
360 INIT_LIST_HEAD(&isc->subdev_entities); in isc_parse_dt()
397 list_add_tail(&subdev_entity->list, &isc->subdev_entities); in isc_parse_dt()
406 struct isc_device *isc; in microchip_isc_probe() local
413 isc = devm_kzalloc(dev, sizeof(*isc), GFP_KERNEL); in microchip_isc_probe()
414 if (!isc) in microchip_isc_probe()
417 platform_set_drvdata(pdev, isc); in microchip_isc_probe()
418 isc->dev = dev; in microchip_isc_probe()
424 isc->regmap = devm_regmap_init_mmio(dev, io_base, &microchip_isc_regmap_config); in microchip_isc_probe()
425 if (IS_ERR(isc->regmap)) { in microchip_isc_probe()
426 ret = PTR_ERR(isc->regmap); in microchip_isc_probe()
436 "microchip-sama5d2-isc", isc); in microchip_isc_probe()
443 isc->gamma_table = isc_sama5d2_gamma_table; in microchip_isc_probe()
444 isc->gamma_max = 2; in microchip_isc_probe()
446 isc->max_width = ISC_SAMA5D2_MAX_SUPPORT_WIDTH; in microchip_isc_probe()
447 isc->max_height = ISC_SAMA5D2_MAX_SUPPORT_HEIGHT; in microchip_isc_probe()
449 isc->config_dpc = isc_sama5d2_config_dpc; in microchip_isc_probe()
450 isc->config_csc = isc_sama5d2_config_csc; in microchip_isc_probe()
451 isc->config_cbc = isc_sama5d2_config_cbc; in microchip_isc_probe()
452 isc->config_cc = isc_sama5d2_config_cc; in microchip_isc_probe()
453 isc->config_gam = isc_sama5d2_config_gam; in microchip_isc_probe()
454 isc->config_rlp = isc_sama5d2_config_rlp; in microchip_isc_probe()
455 isc->config_ctrls = isc_sama5d2_config_ctrls; in microchip_isc_probe()
457 isc->adapt_pipeline = isc_sama5d2_adapt_pipeline; in microchip_isc_probe()
459 isc->offsets.csc = ISC_SAMA5D2_CSC_OFFSET; in microchip_isc_probe()
460 isc->offsets.cbc = ISC_SAMA5D2_CBC_OFFSET; in microchip_isc_probe()
461 isc->offsets.sub422 = ISC_SAMA5D2_SUB422_OFFSET; in microchip_isc_probe()
462 isc->offsets.sub420 = ISC_SAMA5D2_SUB420_OFFSET; in microchip_isc_probe()
463 isc->offsets.rlp = ISC_SAMA5D2_RLP_OFFSET; in microchip_isc_probe()
464 isc->offsets.his = ISC_SAMA5D2_HIS_OFFSET; in microchip_isc_probe()
465 isc->offsets.dma = ISC_SAMA5D2_DMA_OFFSET; in microchip_isc_probe()
466 isc->offsets.version = ISC_SAMA5D2_VERSION_OFFSET; in microchip_isc_probe()
467 isc->offsets.his_entry = ISC_SAMA5D2_HIS_ENTRY_OFFSET; in microchip_isc_probe()
469 isc->controller_formats = sama5d2_controller_formats; in microchip_isc_probe()
470 isc->controller_formats_size = ARRAY_SIZE(sama5d2_controller_formats); in microchip_isc_probe()
471 isc->formats_list = sama5d2_formats_list; in microchip_isc_probe()
472 isc->formats_list_size = ARRAY_SIZE(sama5d2_formats_list); in microchip_isc_probe()
474 /* sama5d2-isc - 8 bits per beat */ in microchip_isc_probe()
475 isc->dcfg = ISC_DCFG_YMBSIZE_BEATS8 | ISC_DCFG_CMBSIZE_BEATS8; in microchip_isc_probe()
477 /* sama5d2-isc : ISPCK is required and mandatory */ in microchip_isc_probe()
478 isc->ispck_required = true; in microchip_isc_probe()
480 ret = microchip_isc_pipeline_init(isc); in microchip_isc_probe()
484 isc->hclock = devm_clk_get(dev, "hclock"); in microchip_isc_probe()
485 if (IS_ERR(isc->hclock)) { in microchip_isc_probe()
486 ret = PTR_ERR(isc->hclock); in microchip_isc_probe()
491 ret = clk_prepare_enable(isc->hclock); in microchip_isc_probe()
497 ret = microchip_isc_clk_init(isc); in microchip_isc_probe()
499 dev_err(dev, "failed to init isc clock: %d\n", ret); in microchip_isc_probe()
502 ret = v4l2_device_register(dev, &isc->v4l2_dev); in microchip_isc_probe()
508 ret = isc_parse_dt(dev, isc); in microchip_isc_probe()
514 if (list_empty(&isc->subdev_entities)) { in microchip_isc_probe()
520 list_for_each_entry(subdev_entity, &isc->subdev_entities, list) { in microchip_isc_probe()
525 v4l2_async_nf_init(&subdev_entity->notifier, &isc->v4l2_dev); in microchip_isc_probe()
547 if (video_is_registered(&isc->video_dev)) in microchip_isc_probe()
551 regmap_read(isc->regmap, ISC_VERSION + isc->offsets.version, &ver); in microchip_isc_probe()
553 ret = isc_mc_init(isc, ver); in microchip_isc_probe()
561 isc->ispck = isc->isc_clks[ISC_ISPCK].clk; in microchip_isc_probe()
563 ret = clk_prepare_enable(isc->ispck); in microchip_isc_probe()
570 ret = clk_set_rate(isc->ispck, clk_get_rate(isc->hclock)); in microchip_isc_probe()
576 dev_info(dev, "Microchip ISC version %x\n", ver); in microchip_isc_probe()
581 clk_disable_unprepare(isc->ispck); in microchip_isc_probe()
587 isc_mc_cleanup(isc); in microchip_isc_probe()
590 microchip_isc_subdev_cleanup(isc); in microchip_isc_probe()
593 v4l2_device_unregister(&isc->v4l2_dev); in microchip_isc_probe()
596 clk_disable_unprepare(isc->hclock); in microchip_isc_probe()
598 microchip_isc_clk_cleanup(isc); in microchip_isc_probe()
605 struct isc_device *isc = platform_get_drvdata(pdev); in microchip_isc_remove() local
609 isc_mc_cleanup(isc); in microchip_isc_remove()
611 microchip_isc_subdev_cleanup(isc); in microchip_isc_remove()
613 v4l2_device_unregister(&isc->v4l2_dev); in microchip_isc_remove()
615 clk_disable_unprepare(isc->ispck); in microchip_isc_remove()
616 clk_disable_unprepare(isc->hclock); in microchip_isc_remove()
618 microchip_isc_clk_cleanup(isc); in microchip_isc_remove()
623 struct isc_device *isc = dev_get_drvdata(dev); in isc_runtime_suspend() local
625 clk_disable_unprepare(isc->ispck); in isc_runtime_suspend()
626 clk_disable_unprepare(isc->hclock); in isc_runtime_suspend()
633 struct isc_device *isc = dev_get_drvdata(dev); in isc_runtime_resume() local
636 ret = clk_prepare_enable(isc->hclock); in isc_runtime_resume()
640 ret = clk_prepare_enable(isc->ispck); in isc_runtime_resume()
642 clk_disable_unprepare(isc->hclock); in isc_runtime_resume()
653 { .compatible = "atmel,sama5d2-isc" },
663 .name = "microchip-sama5d2-isc",
672 MODULE_DESCRIPTION("The V4L2 driver for Microchip-ISC");