[PATCH 1/4] drm/fsl-dcu: Cleanup vblank interrupt mask and status setting code
Stefan Agner
stefan at agner.ch
Mon Jan 25 21:45:15 PST 2016
Hi Meng Yi,
As I wrote earlier
(http://www.spinics.net/lists/dri-devel/msg95703.html), my fixes
patchset contains a similar patch which also explicitly disable the
VBLANK interrupt. I think it is the better solution... See:
https://lkml.org/lkml/2015/11/18/951
I will soon prepare a git tree and plan to submit that for 4.6,
currently I plan to include
- Your "Fix no fb check bug" patch
- My "fixes and enhancements" patchset
- My "fix register initialization" and "use flat regmap cache" patch
Let me know if you have any objections.
--
Stefan
On 2016-01-25 20:00, Meng Yi wrote:
> From: Jianwei Wang <jianwei.wang.chn at gmail.com>
>
> Switch update interrupt mask bit with regmap_update_bits, and clear
> interrupt status by writing 1 to relevant bit before setting mask in
> fsl_dcu_drm_irq_init function.
>
> Signed-off-by: JianWei Wang <jianwei.wang.chn at gmail.com>
> Signed-off-by: Meng Yi <meng.yi at nxp.com>
> ---
> drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 +++++++-------------------
> 1 file changed, 7 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index fca97d3..cbef47c 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -38,21 +38,17 @@ static const struct regmap_config fsl_dcu_regmap_config = {
> static int fsl_dcu_drm_irq_init(struct drm_device *dev)
> {
> struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> - unsigned int value;
> int ret;
>
> ret = drm_irq_install(dev, fsl_dev->irq);
> if (ret < 0)
> dev_err(dev->dev, "failed to install IRQ handler\n");
>
> - ret = regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0);
> + ret = regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0xffffffff);
> if (ret)
> dev_err(dev->dev, "set DCU_INT_STATUS failed\n");
> - ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> - if (ret)
> - dev_err(dev->dev, "read DCU_INT_MASK failed\n");
> - value &= DCU_INT_MASK_VBLANK;
> - ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> + ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK,
> + DCU_INT_MASK_VBLANK, ~DCU_INT_MASK_VBLANK);
> if (ret)
> dev_err(dev->dev, "set DCU_INT_MASK failed\n");
> ret = regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE,
> @@ -143,14 +139,10 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
> static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
> {
> struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> - unsigned int value;
> int ret;
>
> - ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> - if (ret)
> - dev_err(dev->dev, "read DCU_INT_MASK failed\n");
> - value &= ~DCU_INT_MASK_VBLANK;
> - ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> + ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK,
> + DCU_INT_MASK_VBLANK, ~DCU_INT_MASK_VBLANK);
> if (ret)
> dev_err(dev->dev, "set DCU_INT_MASK failed\n");
> return 0;
> @@ -160,14 +152,10 @@ static void fsl_dcu_drm_disable_vblank(struct
> drm_device *dev,
> unsigned int pipe)
> {
> struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
> - unsigned int value;
> int ret;
>
> - ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
> - if (ret)
> - dev_err(dev->dev, "read DCU_INT_MASK failed\n");
> - value |= DCU_INT_MASK_VBLANK;
> - ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
> + ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK,
> + DCU_INT_MASK_VBLANK, DCU_INT_MASK_VBLANK);
> if (ret)
> dev_err(dev->dev, "set DCU_INT_MASK failed\n");
> }
More information about the dri-devel
mailing list