drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c- Extension
.c- Size
- 17289 bytes
- Lines
- 655
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/device.hlinux/io.hlinux/types.himx8-isi-core.himx8-isi-regs.h
Detected Declarations
function mxc_isi_readfunction mxc_isi_writefunction mxc_isi_channel_set_inbuffunction mxc_isi_channel_set_outbuffunction mxc_isi_channel_m2m_startfunction mxc_isi_channel_scaling_ratiofunction mxc_isi_channel_set_scalingfunction mxc_isi_channel_set_cropfunction mxc_isi_channel_set_cscfunction mxc_isi_channel_set_alphafunction mxc_isi_channel_set_flipfunction mxc_isi_channel_set_panic_thresholdfunction mxc_isi_channel_set_controlfunction mxc_isi_channel_configfunction mxc_isi_channel_set_input_formatfunction mxc_isi_channel_set_output_formatfunction mxc_isi_channel_irq_statusfunction mxc_isi_channel_irq_clearfunction mxc_isi_channel_irq_enablefunction mxc_isi_channel_irq_disablefunction mxc_isi_channel_sw_resetfunction __mxc_isi_channel_getfunction mxc_isi_channel_getfunction __mxc_isi_channel_putfunction mxc_isi_channel_putfunction mxc_isi_channel_enablefunction mxc_isi_channel_disablefunction mxc_isi_channel_acquirefunction mxc_isi_channel_releasefunction mxc_isi_channel_chainfunction mxc_isi_channel_unchain
Annotated Snippet
if (pipe->isi->pdata->has_36bit_dma) {
mxc_isi_write(pipe, CHNL_Y_BUF1_XTND_ADDR,
upper_32_bits(dma_addrs[0]));
mxc_isi_write(pipe, CHNL_U_BUF1_XTND_ADDR,
upper_32_bits(dma_addrs[1]));
mxc_isi_write(pipe, CHNL_V_BUF1_XTND_ADDR,
upper_32_bits(dma_addrs[2]));
}
val ^= CHNL_OUT_BUF_CTRL_LOAD_BUF1_ADDR;
} else {
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_Y,
lower_32_bits(dma_addrs[0]));
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_U,
lower_32_bits(dma_addrs[1]));
mxc_isi_write(pipe, CHNL_OUT_BUF2_ADDR_V,
lower_32_bits(dma_addrs[2]));
if (pipe->isi->pdata->has_36bit_dma) {
mxc_isi_write(pipe, CHNL_Y_BUF2_XTND_ADDR,
upper_32_bits(dma_addrs[0]));
mxc_isi_write(pipe, CHNL_U_BUF2_XTND_ADDR,
upper_32_bits(dma_addrs[1]));
mxc_isi_write(pipe, CHNL_V_BUF2_XTND_ADDR,
upper_32_bits(dma_addrs[2]));
}
val ^= CHNL_OUT_BUF_CTRL_LOAD_BUF2_ADDR;
}
mxc_isi_write(pipe, CHNL_OUT_BUF_CTRL, val);
}
void mxc_isi_channel_m2m_start(struct mxc_isi_pipe *pipe)
{
u32 val;
val = mxc_isi_read(pipe, CHNL_MEM_RD_CTRL);
val &= ~CHNL_MEM_RD_CTRL_READ_MEM;
mxc_isi_write(pipe, CHNL_MEM_RD_CTRL, val);
fsleep(300);
val |= CHNL_MEM_RD_CTRL_READ_MEM;
mxc_isi_write(pipe, CHNL_MEM_RD_CTRL, val);
}
/* -----------------------------------------------------------------------------
* Pipeline configuration
*/
static u32 mxc_isi_channel_scaling_ratio(unsigned int from, unsigned int to,
u32 *dec)
{
unsigned int ratio = from / to;
if (ratio < 2)
*dec = 1;
else if (ratio < 4)
*dec = 2;
else if (ratio < 8)
*dec = 4;
else
*dec = 8;
/*
* The ISI rounds output dimensions up to the next integer (i.MX93 RM
* section 57.7.8). Calculate the scale factor such that the theoretical
* output (input / scale_factor) rounds up to exactly the desired
* output.
*/
return min_t(u32, DIV_ROUND_UP(from * 0x1000, to * *dec),
ISI_DOWNSCALE_THRESHOLD);
}
static void mxc_isi_channel_set_scaling(struct mxc_isi_pipe *pipe,
enum mxc_isi_encoding encoding,
const struct v4l2_area *in_size,
const struct v4l2_area *out_size,
bool *bypass)
{
u32 xscale, yscale;
u32 decx, decy;
u32 val;
dev_dbg(pipe->isi->dev, "input %ux%u, output %ux%u\n",
in_size->width, in_size->height,
out_size->width, out_size->height);
xscale = mxc_isi_channel_scaling_ratio(in_size->width, out_size->width,
&decx);
yscale = mxc_isi_channel_scaling_ratio(in_size->height, out_size->height,
&decy);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/io.h`, `linux/types.h`, `imx8-isi-core.h`, `imx8-isi-regs.h`.
- Detected declarations: `function mxc_isi_read`, `function mxc_isi_write`, `function mxc_isi_channel_set_inbuf`, `function mxc_isi_channel_set_outbuf`, `function mxc_isi_channel_m2m_start`, `function mxc_isi_channel_scaling_ratio`, `function mxc_isi_channel_set_scaling`, `function mxc_isi_channel_set_crop`, `function mxc_isi_channel_set_csc`, `function mxc_isi_channel_set_alpha`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.