Commit 0846cca3 authored by Shubhashree Dhar's avatar Shubhashree Dhar Committed by Rob Clark

msm: disp: dpu1: add support to access hw irqs regs depending on revision

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.

Changes in v1:
 - Add support to selectively remove the hw irqs that are not
   not supported.

Changes in v2:
 - Remove unrelated changes.

Changes in v3:
 - Remove change-id (Stephen Boyd).
 - Add colon in variable description to match kernel-doc (Stephen Boyd).
 - Change macro-y way of variable description (Jordon Crouse).
 - Remove unnecessary if checks (Jordon Crouse).
 - Remove extra blank line (Jordon Crouse).

Changes in v4:
 - Remove checkpatch errors.
Signed-off-by: default avatarShubhashree Dhar <dhar@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent cb929b8f
...@@ -421,6 +421,7 @@ static void sdm845_cfg_init(struct dpu_mdss_cfg *dpu_cfg) ...@@ -421,6 +421,7 @@ static void sdm845_cfg_init(struct dpu_mdss_cfg *dpu_cfg)
.reg_dma_count = 1, .reg_dma_count = 1,
.dma_cfg = sdm845_regdma, .dma_cfg = sdm845_regdma,
.perf = sdm845_perf_data, .perf = sdm845_perf_data,
.mdss_irqs = 0x3ff,
}; };
} }
......
...@@ -646,6 +646,7 @@ struct dpu_perf_cfg { ...@@ -646,6 +646,7 @@ struct dpu_perf_cfg {
* @dma_formats Supported formats for dma pipe * @dma_formats Supported formats for dma pipe
* @cursor_formats Supported formats for cursor pipe * @cursor_formats Supported formats for cursor pipe
* @vig_formats Supported formats for vig pipe * @vig_formats Supported formats for vig pipe
* @mdss_irqs: Bitmap with the irqs supported by the target
*/ */
struct dpu_mdss_cfg { struct dpu_mdss_cfg {
u32 hwversion; u32 hwversion;
...@@ -684,6 +685,8 @@ struct dpu_mdss_cfg { ...@@ -684,6 +685,8 @@ struct dpu_mdss_cfg {
const struct dpu_format_extended *dma_formats; const struct dpu_format_extended *dma_formats;
const struct dpu_format_extended *cursor_formats; const struct dpu_format_extended *cursor_formats;
const struct dpu_format_extended *vig_formats; const struct dpu_format_extended *vig_formats;
unsigned long mdss_irqs;
}; };
struct dpu_mdss_hw_cfg_handler { struct dpu_mdss_hw_cfg_handler {
......
...@@ -800,8 +800,8 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, ...@@ -800,8 +800,8 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr,
start_idx = reg_idx * 32; start_idx = reg_idx * 32;
end_idx = start_idx + 32; end_idx = start_idx + 32;
if (start_idx >= ARRAY_SIZE(dpu_irq_map) || if (!test_bit(reg_idx, &intr->irq_mask) ||
end_idx > ARRAY_SIZE(dpu_irq_map)) start_idx >= ARRAY_SIZE(dpu_irq_map))
continue; continue;
/* /*
...@@ -955,8 +955,11 @@ static int dpu_hw_intr_clear_irqs(struct dpu_hw_intr *intr) ...@@ -955,8 +955,11 @@ static int dpu_hw_intr_clear_irqs(struct dpu_hw_intr *intr)
if (!intr) if (!intr)
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) {
DPU_REG_WRITE(&intr->hw, dpu_intr_set[i].clr_off, 0xffffffff); if (test_bit(i, &intr->irq_mask))
DPU_REG_WRITE(&intr->hw,
dpu_intr_set[i].clr_off, 0xffffffff);
}
/* ensure register writes go through */ /* ensure register writes go through */
wmb(); wmb();
...@@ -971,8 +974,11 @@ static int dpu_hw_intr_disable_irqs(struct dpu_hw_intr *intr) ...@@ -971,8 +974,11 @@ static int dpu_hw_intr_disable_irqs(struct dpu_hw_intr *intr)
if (!intr) if (!intr)
return -EINVAL; return -EINVAL;
for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) {
DPU_REG_WRITE(&intr->hw, dpu_intr_set[i].en_off, 0x00000000); if (test_bit(i, &intr->irq_mask))
DPU_REG_WRITE(&intr->hw,
dpu_intr_set[i].en_off, 0x00000000);
}
/* ensure register writes go through */ /* ensure register writes go through */
wmb(); wmb();
...@@ -991,6 +997,9 @@ static void dpu_hw_intr_get_interrupt_statuses(struct dpu_hw_intr *intr) ...@@ -991,6 +997,9 @@ static void dpu_hw_intr_get_interrupt_statuses(struct dpu_hw_intr *intr)
spin_lock_irqsave(&intr->irq_lock, irq_flags); spin_lock_irqsave(&intr->irq_lock, irq_flags);
for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) { for (i = 0; i < ARRAY_SIZE(dpu_intr_set); i++) {
if (!test_bit(i, &intr->irq_mask))
continue;
/* Read interrupt status */ /* Read interrupt status */
intr->save_irq_status[i] = DPU_REG_READ(&intr->hw, intr->save_irq_status[i] = DPU_REG_READ(&intr->hw,
dpu_intr_set[i].status_off); dpu_intr_set[i].status_off);
...@@ -1115,6 +1124,7 @@ struct dpu_hw_intr *dpu_hw_intr_init(void __iomem *addr, ...@@ -1115,6 +1124,7 @@ struct dpu_hw_intr *dpu_hw_intr_init(void __iomem *addr,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
intr->irq_mask = m->mdss_irqs;
spin_lock_init(&intr->irq_lock); spin_lock_init(&intr->irq_lock);
return intr; return intr;
......
...@@ -187,6 +187,7 @@ struct dpu_hw_intr { ...@@ -187,6 +187,7 @@ struct dpu_hw_intr {
u32 *save_irq_status; u32 *save_irq_status;
u32 irq_idx_tbl_size; u32 irq_idx_tbl_size;
spinlock_t irq_lock; spinlock_t irq_lock;
unsigned long irq_mask;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment