Files
cubelinux-kernel/drivers/gpu/drm/loongson/lsdc_pixpll.h
T
Greg Kroah-Hartman 598cf27219 Linux 6.19.3
Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
Tested-by: Peter Schneider <pschneider1968@googlemail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Tested-by: Brett A C Sheffield <bacs@librecast.net>
Tested-by: Mark Brown <broonie@kernel.org>
Tested-by: Luna Jernberg <droidbittin@gmail.com>
Tested-by: Ronald Warsow <rwarsow@gmx.de>
Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-02-19 16:33:27 +01:00

87 lines
2.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 2023 Loongson Technology Corporation Limited
*/
#ifndef __LSDC_PIXPLL_H__
#define __LSDC_PIXPLL_H__
#include <drm/drm_device.h>
/*
* Loongson Pixel PLL hardware structure
*
* refclk: reference frequency, 100 MHz from external oscillator
* outclk: output frequency desired.
*
*
* L1 Fref Fvco L2
* refclk +-----------+ +------------------+ +---------+ outclk
* ---+---> | Prescaler | ---> | Clock Multiplier | ---> | divider | -------->
* | +-----------+ +------------------+ +---------+ ^
* | ^ ^ ^ |
* | | | | |
* | | | | |
* | div_ref loopc div_out |
* | |
* +---- bypass (bypass above software configurable clock if set) ----+
*
* outclk = refclk / div_ref * loopc / div_out;
*
* sel_out: PLL clock output selector(enable).
*
* If sel_out == 1, then enable output clock (turn On);
* If sel_out == 0, then disable output clock (turn Off);
*
* PLL working requirements:
*
* 1) 20 MHz <= refclk / div_ref <= 40Mhz
* 2) 1.2 GHz <= refclk /div_out * loopc <= 3.2 Ghz
*/
struct lsdc_pixpll_parms {
unsigned int ref_clock;
unsigned int div_ref;
unsigned int loopc;
unsigned int div_out;
};
struct lsdc_pixpll;
struct lsdc_pixpll_funcs {
int (*setup)(struct lsdc_pixpll * const this);
int (*compute)(struct lsdc_pixpll * const this,
unsigned int clock,
struct lsdc_pixpll_parms *pout);
int (*update)(struct lsdc_pixpll * const this,
struct lsdc_pixpll_parms const *pin);
unsigned int (*get_rate)(struct lsdc_pixpll * const this);
void (*print)(struct lsdc_pixpll * const this,
struct drm_printer *printer);
};
struct lsdc_pixpll {
const struct lsdc_pixpll_funcs *funcs;
struct drm_device *ddev;
/* PLL register offset */
u32 reg_base;
/* PLL register size in bytes */
u32 reg_size;
void __iomem *mmio;
struct lsdc_pixpll_parms *priv;
};
int lsdc_pixpll_init(struct lsdc_pixpll * const this,
struct drm_device *ddev,
unsigned int index);
#endif