Skip to content
Snippets Groups Projects
  • Fancy Fang's avatar
    drm/imx: sec-dsim_imx: a general way to compute PLL PMS · ff1fc3ab
    Fancy Fang authored
    
    A fixed PLL PMS setting for attached panel is obviously not
    enough for any other mipi panel which needs a different PLL
    output clock frequency, and besides, for the CEA-861 standard
    display modes, the 'pll_pms' table also can not cover all the
    modes requirements. So a general way is created to solve this
    problem which can provide an optimum solution to output a PLL
    bit clock to match the request frequency in a maximum degree
    and also satisfy the input clock and intermediate clocks limit
    according to the PLL specification.
    
    (This is the DSIM controller driver change for PLL PMS compute.)
    
    Signed-off-by: default avatarFancy Fang <chen.fang@nxp.com>
    ff1fc3ab
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
sec_mipi_pll_1432x.h 1.42 KiB
/*
 * Samsung MIPI DSIM PLL_1432X
 *
 * Copyright 2019 NXP
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __SEC_DSIM_PLL_1432X_H__
#define __SEC_DSIM_PLL_1432X_H__

#include <drm/bridge/sec_mipi_dsim.h>
/*
 * DSIM PLL_1432X setting guide from spec:
 *
 * Fout(bitclk) = ((m + k / 65536) * Fin) / (p * 2^s), and
 * p = P[5:0], m = M[9:0], s = S[2:0], k = K[15:0];
 *
 * Fpref = Fin / p
 * Fin: [6MHz ~ 300MHz], Fpref: [2MHz ~ 30MHz]
 *
 * Fvco = ((m + k / 65536) * Fin) / p
 * Fvco: [1050MHz ~ 2100MHz]
 *
 * 1 <= P[5:0] <= 63, 64 <= M[9:0] <= 1023,
 * 0 <= S[2:0] <=  5, -32768 <= K[15:0] <= 32767
 *
 */

const struct sec_mipi_dsim_pll pll_1432x = {
	.p	= { .min = 1,		.max = 63,	},
	.m	= { .min = 64,		.max = 1023,	},
	.s	= { .min = 0,		.max = 5,	},
	.k	= { .min = 0,		.max = 32768,	},	/* abs(k) */
	.fin	= { .min = 6000,	.max = 300000,	},	/* in KHz */
	.fpref	= { .min = 2000,	.max = 30000,	},	/* in KHz */
	.fvco	= { .min = 1050000,	.max = 2100000,	},	/* in KHz */
};

#endif