Skip to content

Commit a682169

Browse files
committed
Merge tag 'imx-drm-next-2017-06-08' of git://git.pengutronix.de/git/pza/linux into drm-next
imx-drm: cleanups and YUV 4:2:0 memory read/write reduction support - Remove counter load enable form PRE, which has no effect. - Add support for setting the double read/write reduction flag in channel parameter memory. This can be used to save some memory bandwidth when capturing in YUV 4:2:0 chroma subsampled formats. - Allocate DMA channel structures as needed, most of the 64 channels are unused or even reserved. - Remove unused interrupt busy waiting routine. - Set VDIC field order for both AUTO and MAN inputs simultaneously as both can't be active at the same time. * tag 'imx-drm-next-2017-06-08' of git://git.pengutronix.de/git/pza/linux: gpu: ipu-v3: vdic: include AUTO field order bit in ipu_vdi_set_field_order gpu: ipu-v3: remove interrupt busy waiting routine gpu: ipu-v3: allocate ipuv3_channels as needed gpu: ipu-v3: Add support for double read/write reduction gpu: ipu-v3: prg: remove counter load enable
2 parents 033fd32 + add1318 commit a682169

6 files changed

Lines changed: 26 additions & 35 deletions

File tree

‎drivers/gpu/ipu-v3/ipu-common.c‎

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,22 @@ struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned num)
274274

275275
mutex_lock(&ipu->channel_lock);
276276

277-
channel = &ipu->channel[num];
277+
list_for_each_entry(channel, &ipu->channels, list) {
278+
if (channel->num == num) {
279+
channel = ERR_PTR(-EBUSY);
280+
goto out;
281+
}
282+
}
278283

279-
if (channel->busy) {
280-
channel = ERR_PTR(-EBUSY);
284+
channel = kzalloc(sizeof(*channel), GFP_KERNEL);
285+
if (!channel) {
286+
channel = ERR_PTR(-ENOMEM);
281287
goto out;
282288
}
283289

284-
channel->busy = true;
285290
channel->num = num;
291+
channel->ipu = ipu;
292+
list_add(&channel->list, &ipu->channels);
286293

287294
out:
288295
mutex_unlock(&ipu->channel_lock);
@@ -299,7 +306,8 @@ void ipu_idmac_put(struct ipuv3_channel *channel)
299306

300307
mutex_lock(&ipu->channel_lock);
301308

302-
channel->busy = false;
309+
list_del(&channel->list);
310+
kfree(channel);
303311

304312
mutex_unlock(&ipu->channel_lock);
305313
}
@@ -589,22 +597,6 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms)
589597
}
590598
EXPORT_SYMBOL_GPL(ipu_idmac_wait_busy);
591599

592-
int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms)
593-
{
594-
unsigned long timeout;
595-
596-
timeout = jiffies + msecs_to_jiffies(ms);
597-
ipu_cm_write(ipu, BIT(irq % 32), IPU_INT_STAT(irq / 32));
598-
while (!(ipu_cm_read(ipu, IPU_INT_STAT(irq / 32) & BIT(irq % 32)))) {
599-
if (time_after(jiffies, timeout))
600-
return -ETIMEDOUT;
601-
cpu_relax();
602-
}
603-
604-
return 0;
605-
}
606-
EXPORT_SYMBOL_GPL(ipu_wait_interrupt);
607-
608600
int ipu_idmac_disable_channel(struct ipuv3_channel *channel)
609601
{
610602
struct ipu_soc *ipu = channel->ipu;
@@ -1376,7 +1368,7 @@ static int ipu_probe(struct platform_device *pdev)
13761368
struct ipu_soc *ipu;
13771369
struct resource *res;
13781370
unsigned long ipu_base;
1379-
int i, ret, irq_sync, irq_err;
1371+
int ret, irq_sync, irq_err;
13801372
const struct ipu_devtype *devtype;
13811373

13821374
devtype = of_device_get_match_data(&pdev->dev);
@@ -1409,13 +1401,12 @@ static int ipu_probe(struct platform_device *pdev)
14091401
return -EPROBE_DEFER;
14101402
}
14111403

1412-
for (i = 0; i < 64; i++)
1413-
ipu->channel[i].ipu = ipu;
14141404
ipu->devtype = devtype;
14151405
ipu->ipu_type = devtype->type;
14161406

14171407
spin_lock_init(&ipu->lock);
14181408
mutex_init(&ipu->channel_lock);
1409+
INIT_LIST_HEAD(&ipu->channels);
14191410

14201411
dev_dbg(&pdev->dev, "cm_reg: 0x%08lx\n",
14211412
ipu_base + devtype->cm_ofs);

‎drivers/gpu/ipu-v3/ipu-cpmem.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,12 @@ void ipu_cpmem_set_resolution(struct ipuv3_channel *ch, int xres, int yres)
224224
}
225225
EXPORT_SYMBOL_GPL(ipu_cpmem_set_resolution);
226226

227+
void ipu_cpmem_skip_odd_chroma_rows(struct ipuv3_channel *ch)
228+
{
229+
ipu_ch_param_write_field(ch, IPU_FIELD_RDRW, 1);
230+
}
231+
EXPORT_SYMBOL_GPL(ipu_cpmem_skip_odd_chroma_rows);
232+
227233
void ipu_cpmem_set_stride(struct ipuv3_channel *ch, int stride)
228234
{
229235
ipu_ch_param_write_field(ch, IPU_FIELD_SLY, stride - 1);

‎drivers/gpu/ipu-v3/ipu-prg.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,6 @@ int ipu_prg_channel_configure(struct ipuv3_channel *ipu_chan,
318318
writel(val, prg->regs + IPU_PRG_BADDR(prg_chan));
319319

320320
val = readl(prg->regs + IPU_PRG_CTL);
321-
/* counter load enable */
322-
val |= IPU_PRG_CTL_CNT_LOAD_EN(prg_chan);
323321
/* config AXI ID */
324322
val &= ~(IPU_PRG_CTL_SOFT_ARID_MASK <<
325323
IPU_PRG_CTL_SOFT_ARID_SHIFT(prg_chan));

‎drivers/gpu/ipu-v3/ipu-prv.h‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,8 @@ enum ipu_modules {
157157

158158
struct ipuv3_channel {
159159
unsigned int num;
160-
161-
bool enabled;
162-
bool busy;
163-
164160
struct ipu_soc *ipu;
161+
struct list_head list;
165162
};
166163

167164
struct ipu_cpmem;
@@ -184,6 +181,7 @@ struct ipu_soc {
184181
enum ipuv3_type ipu_type;
185182
spinlock_t lock;
186183
struct mutex channel_lock;
184+
struct list_head channels;
187185

188186
void __iomem *cm_reg;
189187
void __iomem *idmac_reg;
@@ -193,8 +191,6 @@ struct ipu_soc {
193191

194192
struct clk *clk;
195193

196-
struct ipuv3_channel channel[64];
197-
198194
int irq_sync;
199195
int irq_err;
200196
struct irq_domain *domain;
@@ -229,7 +225,6 @@ int ipu_module_enable(struct ipu_soc *ipu, u32 mask);
229225
int ipu_module_disable(struct ipu_soc *ipu, u32 mask);
230226

231227
bool ipu_idmac_channel_busy(struct ipu_soc *ipu, unsigned int chno);
232-
int ipu_wait_interrupt(struct ipu_soc *ipu, int irq, int ms);
233228

234229
int ipu_csi_init(struct ipu_soc *ipu, struct device *dev, int id,
235230
unsigned long base, u32 module, struct clk *clk_ipu);

‎drivers/gpu/ipu-v3/ipu-vdi.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ void ipu_vdi_set_field_order(struct ipu_vdi *vdi, v4l2_std_id std, u32 field)
8888

8989
reg = ipu_vdi_read(vdi, VDI_C);
9090
if (top_field_0)
91-
reg &= ~VDI_C_TOP_FIELD_MAN_1;
91+
reg &= ~(VDI_C_TOP_FIELD_MAN_1 | VDI_C_TOP_FIELD_AUTO_1);
9292
else
93-
reg |= VDI_C_TOP_FIELD_MAN_1;
93+
reg |= VDI_C_TOP_FIELD_MAN_1 | VDI_C_TOP_FIELD_AUTO_1;
9494
ipu_vdi_write(vdi, reg, VDI_C);
9595

9696
spin_unlock_irqrestore(&vdi->lock, flags);

‎include/video/imx-ipu-v3.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ struct ipu_image {
250250

251251
void ipu_cpmem_zero(struct ipuv3_channel *ch);
252252
void ipu_cpmem_set_resolution(struct ipuv3_channel *ch, int xres, int yres);
253+
void ipu_cpmem_skip_odd_chroma_rows(struct ipuv3_channel *ch);
253254
void ipu_cpmem_set_stride(struct ipuv3_channel *ch, int stride);
254255
void ipu_cpmem_set_high_priority(struct ipuv3_channel *ch);
255256
void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf);

0 commit comments

Comments
 (0)