drivers/gpu/drm/imx/dcss/dcss-scaler.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imx/dcss/dcss-scaler.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imx/dcss/dcss-scaler.c- Extension
.c- Size
- 23432 bytes
- Lines
- 844
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/slab.hdcss-dev.h
Detected Declarations
struct dcss_scaler_chstruct dcss_scalerstruct dcss_scaler_factorsenum buffer_formatenum chroma_locationfunction mult_qfunction div_qfunction exp_approx_qfunction dcss_scaler_gaussian_filterfunction dcss_scaler_nearest_neighbor_filterfunction dcss_scaler_filter_designfunction dcss_scaler_writefunction dcss_scaler_ch_init_allfunction dcss_scaler_initfunction dcss_scaler_exitfunction dcss_scaler_ch_enablefunction dcss_scaler_yuv_enablefunction dcss_scaler_rtr_8lines_enablefunction dcss_scaler_bit_depth_setfunction dcss_scaler_format_setfunction dcss_scaler_res_setfunction dcss_scaler_fractions_setfunction dcss_scaler_get_min_max_ratiosfunction dcss_scaler_program_5_coef_setfunction dcss_scaler_program_7_coef_setfunction dcss_scaler_yuv_coef_setfunction dcss_scaler_rgb_coef_setfunction dcss_scaler_set_rgb10_orderfunction dcss_scaler_set_filterfunction dcss_scaler_setupfunction dcss_scaler_write_sclctrl
Annotated Snippet
struct dcss_scaler_ch {
void __iomem *base_reg;
u32 base_ofs;
struct dcss_scaler *scl;
u32 sdata_ctrl;
u32 scaler_ctrl;
bool scaler_ctrl_chgd;
u32 c_vstart;
u32 c_hstart;
bool use_nn_interpolation;
};
struct dcss_scaler {
struct device *dev;
struct dcss_ctxld *ctxld;
u32 ctx_id;
struct dcss_scaler_ch ch[3];
};
/* scaler coefficients generator */
#define PSC_FRAC_BITS 30
#define PSC_FRAC_SCALE BIT(PSC_FRAC_BITS)
#define PSC_BITS_FOR_PHASE 4
#define PSC_NUM_PHASES 16
#define PSC_STORED_PHASES (PSC_NUM_PHASES / 2 + 1)
#define PSC_NUM_TAPS 7
#define PSC_NUM_TAPS_RGBA 5
#define PSC_COEFF_PRECISION 10
#define PSC_PHASE_FRACTION_BITS 13
#define PSC_PHASE_MASK (PSC_NUM_PHASES - 1)
#define PSC_Q_FRACTION 19
#define PSC_Q_ROUND_OFFSET (1 << (PSC_Q_FRACTION - 1))
/**
* mult_q() - Performs fixed-point multiplication.
* @A: multiplier
* @B: multiplicand
*/
static int mult_q(int A, int B)
{
int result;
s64 temp;
temp = (int64_t)A * (int64_t)B;
temp += PSC_Q_ROUND_OFFSET;
result = (int)(temp >> PSC_Q_FRACTION);
return result;
}
/**
* div_q() - Performs fixed-point division.
* @A: dividend
* @B: divisor
*/
static int div_q(int A, int B)
{
int result;
s64 temp;
temp = (int64_t)A << PSC_Q_FRACTION;
if ((temp >= 0 && B >= 0) || (temp < 0 && B < 0))
temp += B / 2;
else
temp -= B / 2;
result = div_s64(temp, B);
return result;
}
/**
* exp_approx_q() - Compute approximation to exp(x) function using Taylor
* series.
* @x: fixed-point argument of exp function
*/
static int exp_approx_q(int x)
{
int sum = 1 << PSC_Q_FRACTION;
int term = 1 << PSC_Q_FRACTION;
term = mult_q(term, div_q(x, 1 << PSC_Q_FRACTION));
sum += term;
term = mult_q(term, div_q(x, 2 << PSC_Q_FRACTION));
sum += term;
term = mult_q(term, div_q(x, 3 << PSC_Q_FRACTION));
Annotation
- Immediate include surface: `linux/device.h`, `linux/slab.h`, `dcss-dev.h`.
- Detected declarations: `struct dcss_scaler_ch`, `struct dcss_scaler`, `struct dcss_scaler_factors`, `enum buffer_format`, `enum chroma_location`, `function mult_q`, `function div_q`, `function exp_approx_q`, `function dcss_scaler_gaussian_filter`, `function dcss_scaler_nearest_neighbor_filter`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.