/* * rcar_cmm_lut_write() - Scale the DRM LUT table entries to hardware precision * and write to the CMM registers * @rcmm: Pointer to the CMM device * @drm_lut: Pointer to the DRM LUT table
*/ staticvoid rcar_cmm_lut_write(struct rcar_cmm *rcmm, conststruct drm_color_lut *drm_lut)
{ unsignedint i;
for (i = 0; i < CM2_LUT_SIZE; ++i) {
u32 entry = drm_color_lut_extract(drm_lut[i].red, 8) << 16
| drm_color_lut_extract(drm_lut[i].green, 8) << 8
| drm_color_lut_extract(drm_lut[i].blue, 8);
rcar_cmm_write(rcmm, CM2_LUT_TBL(i), entry);
}
}
/* * rcar_cmm_setup() - Configure the CMM unit * @pdev: The platform device associated with the CMM instance * @config: The CMM unit configuration * * Configure the CMM unit with the given configuration. Currently enabling, * disabling and programming of the 1-D LUT unit is supported. * * As rcar_cmm_setup() accesses the CMM registers the unit should be powered * and its functional clock enabled. To guarantee this, before any call to * this function is made, the CMM unit has to be enabled by calling * rcar_cmm_enable() first. * * TODO: Add support for LUT double buffer operations to avoid updating the * LUT table entries while a frame is being displayed.
*/ int rcar_cmm_setup(struct platform_device *pdev, conststruct rcar_cmm_config *config)
{ struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
/* Disable LUT if no table is provided. */ if (!config->lut.table) { if (rcmm->lut.enabled) {
rcar_cmm_write(rcmm, CM2_LUT_CTRL, 0);
rcmm->lut.enabled = false;
}
return 0;
}
/* Enable LUT and program the new gamma table values. */ if (!rcmm->lut.enabled) {
rcar_cmm_write(rcmm, CM2_LUT_CTRL, CM2_LUT_CTRL_LUT_EN);
rcmm->lut.enabled = true;
}
rcar_cmm_lut_write(rcmm, config->lut.table);
return 0;
}
EXPORT_SYMBOL_GPL(rcar_cmm_setup);
/* * rcar_cmm_enable() - Enable the CMM unit * @pdev: The platform device associated with the CMM instance * * When the output of the corresponding DU channel is routed to the CMM unit, * the unit shall be enabled before the DU channel is started, and remain * enabled until the channel is stopped. The CMM unit shall be disabled with * rcar_cmm_disable(). * * Calls to rcar_cmm_enable() and rcar_cmm_disable() are not reference-counted. * It is an error to attempt to enable an already enabled CMM unit, or to * attempt to disable a disabled unit.
*/ int rcar_cmm_enable(struct platform_device *pdev)
{ int ret;
ret = pm_runtime_resume_and_get(&pdev->dev); if (ret < 0) return ret;
return 0;
}
EXPORT_SYMBOL_GPL(rcar_cmm_enable);
/* * rcar_cmm_disable() - Disable the CMM unit * @pdev: The platform device associated with the CMM instance * * See rcar_cmm_enable() for usage information. * * Disabling the CMM unit disable all the internal processing blocks. The CMM * state shall thus be restored with rcar_cmm_setup() when re-enabling the CMM * unit after the next rcar_cmm_enable() call.
*/ void rcar_cmm_disable(struct platform_device *pdev)
{ struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
/* * rcar_cmm_init() - Initialize the CMM unit * @pdev: The platform device associated with the CMM instance * * Return: 0 on success, -EPROBE_DEFER if the CMM is not available yet, * -ENODEV if the DRM_RCAR_CMM config option is disabled
*/ int rcar_cmm_init(struct platform_device *pdev)
{ struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.