/*
* rcar_cmm_setup() - Configure the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The device associated with the CMM instance
* @config: The CMM unit configuration
*
* Configure the CMM unit with the given configuration. Currently enabling,
* 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,
+int rcar_cmm_setup(struct device *dev,
const struct rcar_cmm_config *config)
{
- struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
+ struct rcar_cmm *rcmm = dev_get_drvdata(dev);
/* Disable LUT if no table is provided. */
if (!config->lut.table) {
/*
* rcar_cmm_enable() - Enable the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The 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
* 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 rcar_cmm_enable(struct device *dev)
{
int ret;
- ret = pm_runtime_resume_and_get(&pdev->dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
return ret;
/*
* rcar_cmm_disable() - Disable the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The device associated with the CMM instance
*
* See rcar_cmm_enable() for usage information.
*
* 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)
+void rcar_cmm_disable(struct device *dev)
{
- struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
+ struct rcar_cmm *rcmm = dev_get_drvdata(dev);
rcar_cmm_write(rcmm, CM2_LUT_CTRL, 0);
rcmm->lut.enabled = false;
- pm_runtime_put(&pdev->dev);
+ pm_runtime_put(dev);
}
EXPORT_SYMBOL_GPL(rcar_cmm_disable);
/*
* rcar_cmm_init() - Initialize the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The 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)
+int rcar_cmm_init(struct device *dev)
{
- struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
+ struct rcar_cmm *rcmm = dev_get_drvdata(dev);
if (!rcmm)
return -EPROBE_DEFER;
#define CM2_LUT_SIZE 256
+struct device;
struct drm_color_lut;
-struct platform_device;
/**
* struct rcar_cmm_config - CMM configuration
};
#if IS_ENABLED(CONFIG_DRM_RCAR_CMM)
-int rcar_cmm_init(struct platform_device *pdev);
+int rcar_cmm_init(struct device *dev);
-int rcar_cmm_enable(struct platform_device *pdev);
-void rcar_cmm_disable(struct platform_device *pdev);
+int rcar_cmm_enable(struct device *dev);
+void rcar_cmm_disable(struct device *dev);
-int rcar_cmm_setup(struct platform_device *pdev,
+int rcar_cmm_setup(struct device *dev,
const struct rcar_cmm_config *config);
#else
-static inline int rcar_cmm_init(struct platform_device *pdev)
+static inline int rcar_cmm_init(struct device *dev)
{
return -ENODEV;
}
-static inline int rcar_cmm_enable(struct platform_device *pdev)
+static inline int rcar_cmm_enable(struct device *dev)
{
return 0;
}
-static inline void rcar_cmm_disable(struct platform_device *pdev)
+static inline void rcar_cmm_disable(struct device *dev)
{
}
-static inline int rcar_cmm_setup(struct platform_device *pdev,
+static inline int rcar_cmm_setup(struct device *dev,
const struct rcar_cmm_config *config)
{
return 0;
* -ENODEV is used to report that the CMM config option is
* disabled: return 0 and let the DU continue probing.
*/
- ret = rcar_cmm_init(pdev);
+ ret = rcar_cmm_init(&pdev->dev);
if (ret) {
platform_device_put(pdev);
return ret == -ENODEV ? 0 : ret;
}
- rcdu->cmms[i] = pdev;
+ rcdu->cmms[i] = &pdev->dev;
/*
* Enforce suspend/resume ordering by making the CMM a provider
unsigned int i;
for (i = 0; i < ARRAY_SIZE(rcdu->cmms); ++i)
- platform_device_put(rcdu->cmms[i]);
+ put_device(rcdu->cmms[i]);
}
int rcar_du_modeset_init(struct rcar_du_device *rcdu)