Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2779285ybc; Wed, 13 Nov 2019 21:56:44 -0800 (PST) X-Google-Smtp-Source: APXvYqw64sA6vYndoLENeNlg4l8IBnths2XzPMoaVucraRJwRRSJ1uC4MYHWy+3HOLGzVfxjhlsa X-Received: by 2002:a50:85cb:: with SMTP id q11mr7816604edh.141.1573711003958; Wed, 13 Nov 2019 21:56:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573711003; cv=none; d=google.com; s=arc-20160816; b=BBM0ZhSpL/K/pl7PUevWymESmG+ztRyXL1wDH1d9ANW2H873LPwCsQpx8TmPd0c7fx 8mPPV7lTPOKJt1ZVwV5ZxuJZ0Jop4CXdGdeVoeCkSTEoFzQ2cymt27tdfHX/dI5IUOHJ kRiMzOEsWRwfpKJhfFfofEjV67lCBpLKAUG1UBKaZlgJOafzsYgSfMWmDyav2jBIXkJl i82CLieLL0FsSPBS6tj76MI+Kj5JtHnFccVO0akNS6YRDEHzBJa6hEmTUAMRucS+bc0q FcHXd0ADcT4JhHb5gVCiHQ6Y4dZoOeIDDaTT0A1tzFHT7UCAVGI8/7uKcl8euxZ2qZ10 d5Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr; bh=HAZe1JHNqUlLz/XbcVtm9YuFv7WDfD29JwZD80CHAx4=; b=kMXo+VEC1zxVjlB1zxc4bEuY++kS3iyCJQ5CscuHRGce24mNWhHDzvJHODBoCkYMdV Q0A6/bcBHB9h9by3Yu3bMk2S6eKt6w/l8EgiwWGO7uS/gdV5DJ9ssbwfhjiVfbHy8S93 MjaZG0sfPJ9akEEWveHYxSTIeLcRPUAQmELXTIYbzfaOiOPQk6ZSL6Do/xbpqJ+OC7fj qlOJ7PZp8hHX8RBGk+gbT/0D48ZDcdQrYj2Xj6gygYYpiayAUTJAO2ghF2h0l4GOWZIu HexHoVZ0IRV7WRAUS5lvRiBS3TUcXbVrw3cyv7uJFPK21fWzb2+ocrBfRZDTzXZsm6uO Oxjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si3216934eda.288.2019.11.13.21.56.19; Wed, 13 Nov 2019 21:56:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726002AbfKNFzt (ORCPT + 99 others); Thu, 14 Nov 2019 00:55:49 -0500 Received: from alexa-out-blr-01.qualcomm.com ([103.229.18.197]:18715 "EHLO alexa-out-blr-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbfKNFzs (ORCPT ); Thu, 14 Nov 2019 00:55:48 -0500 X-Greylist: delayed 367 seconds by postgrey-1.27 at vger.kernel.org; Thu, 14 Nov 2019 00:55:43 EST Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 14 Nov 2019 11:19:35 +0530 IronPort-SDR: VCwIU6ST0YHjpp+A8fMy4sc0Oc0DL5w4hpf2qMpQnijYy4LXhU8sYbryqJm6F6nu4dmk+3WZK1 W3jDOPh+LBzjlZrZ4wH3DsIjZkZH6hnUochfhEo0F2P93Nchv5PMUvS2yE1ikitpShlxitY3wL THBnbyCAjxXFV/xjp+kae0694Fe7G2kYl95qKPlwNMClxktv2rPdibOSEcEEPiFEKw1Qglhpwa +lhJ5ycbh76UIc1y9yiXuAU2fZZlnk6u04OMkdyTWu5Lkr9PQMwZ7Cikq0brfqMCgeLfHp3NEy zEPXKuJzIPXfWmYkQim0b1jj Received: from dhar-linux.qualcomm.com ([10.204.66.25]) by ironmsg02-blr.qualcomm.com with ESMTP; 14 Nov 2019 11:19:10 +0530 Received: by dhar-linux.qualcomm.com (Postfix, from userid 2306995) id 092583AE6; Thu, 14 Nov 2019 11:19:09 +0530 (IST) From: Shubhashree Dhar To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org Cc: Shubhashree Dhar , linux-kernel@vger.kernel.org, robdclark@gmail.com, seanpaul@chromium.org, hoegsberg@chromium.org, abhinavk@codeaurora.org, jsanka@codeaurora.org, chandanu@codeaurora.org, nganji@codeaurora.org Subject: [v1] msm: disp: dpu1: add support to access hw irqs regs depending on revision Date: Thu, 14 Nov 2019 11:18:56 +0530 Message-Id: <1573710536-26889-1-git-send-email-dhar@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current code assumes that all the irqs registers offsets can be accessed in all the hw revisions; this is not the case for some targets that should not access some of the irq registers. This change adds the support to selectively remove the irqs that are not supported in some of the hw revisions. Change-Id: I6052b8237b703a1a9edd53893e04f7bd72223da1 Signed-off-by: Shubhashree Dhar --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 3 + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 22 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 1 + drivers/gpu/drm/panel/panel-visionox-rm69299.c | 478 ++++++++++++++++++++++ 5 files changed, 500 insertions(+), 5 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-visionox-rm69299.c diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index 04c8c44..357e15b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -421,6 +421,7 @@ static void sdm845_cfg_init(struct dpu_mdss_cfg *dpu_cfg) .reg_dma_count = 1, .dma_cfg = sdm845_regdma, .perf = sdm845_perf_data, + .mdss_irqs[0] = 0x3ff, }; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h index ec76b868..def8a3f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -646,6 +646,7 @@ struct dpu_perf_cfg { * @dma_formats Supported formats for dma pipe * @cursor_formats Supported formats for cursor pipe * @vig_formats Supported formats for vig pipe + * @mdss_irqs Bitmap with the irqs supported by the target */ struct dpu_mdss_cfg { u32 hwversion; @@ -684,6 +685,8 @@ struct dpu_mdss_cfg { struct dpu_format_extended *dma_formats; struct dpu_format_extended *cursor_formats; struct dpu_format_extended *vig_formats; + + DECLARE_BITMAP(mdss_irqs, BITS_PER_BYTE * sizeof(long)); }; struct dpu_mdss_hw_cfg_handler { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c index 8bfa7d0..2a3634c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c @@ -800,7 +800,8 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, start_idx = reg_idx * 32; end_idx = start_idx + 32; - if (start_idx >= ARRAY_SIZE(dpu_irq_map) || + if (!test_bit(reg_idx, &intr->irq_mask) || + start_idx >= ARRAY_SIZE(dpu_irq_map) || end_idx > ARRAY_SIZE(dpu_irq_map)) continue; @@ -955,8 +956,11 @@ static int dpu_hw_intr_clear_irqs(struct dpu_hw_intr *intr) if (!intr) return -EINVAL; - for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) - DPU_REG_WRITE(&intr->hw, dpu_intr_set[i].clr_off, 0xffffffff); + for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) { + if(test_bit(i, &intr->irq_mask)) + DPU_REG_WRITE(&intr->hw, + dpu_intr_set[i].clr_off, 0xffffffff); + } /* ensure register writes go through */ wmb(); @@ -971,8 +975,11 @@ static int dpu_hw_intr_disable_irqs(struct dpu_hw_intr *intr) if (!intr) return -EINVAL; - for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) - DPU_REG_WRITE(&intr->hw, dpu_intr_set[i].en_off, 0x00000000); + for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) { + if(test_bit(i, &intr->irq_mask)) + DPU_REG_WRITE(&intr->hw, + dpu_intr_set[i].en_off, 0x00000000); + } /* ensure register writes go through */ wmb(); @@ -991,6 +998,10 @@ static void dpu_hw_intr_get_interrupt_statuses(struct dpu_hw_intr *intr) spin_lock_irqsave(&intr->irq_lock, irq_flags); for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) { + + if(!test_bit(i, &intr->irq_mask)) + continue; + /* Read interrupt status */ intr->save_irq_status[i] = DPU_REG_READ(&intr->hw, dpu_intr_set[i].status_off); @@ -1115,6 +1126,7 @@ struct dpu_hw_intr *dpu_hw_intr_init(void __iomem *addr, return ERR_PTR(-ENOMEM); } + intr->irq_mask = m->mdss_irqs[0]; spin_lock_init(&intr->irq_lock); return intr; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h index 4edcf40..fc9c986 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h @@ -187,6 +187,7 @@ struct dpu_hw_intr { u32 *save_irq_status; u32 irq_idx_tbl_size; spinlock_t irq_lock; + unsigned long irq_mask; }; /** diff --git a/drivers/gpu/drm/panel/panel-visionox-rm69299.c b/drivers/gpu/drm/panel/panel-visionox-rm69299.c new file mode 100644 index 00000000..1bbd40d --- /dev/null +++ b/drivers/gpu/drm/panel/panel-visionox-rm69299.c @@ -0,0 +1,478 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include