// SPDX-License-Identifier: GPL-2.0-only /* * pmic-cpcap.c - CPCAP-specific functions for the OPP code * * Adapted from Motorola Mapphone Android Linux kernel * Copyright (C) 2011 Motorola, Inc.
*/
/** * omap_cpcap_vsel_to_uv - convert CPCAP VSEL value to microvolts DC * @vsel: CPCAP VSEL value to convert * * Returns: the microvolts DC that the CPCAP PMIC should generate when * programmed with @vsel.
*/ staticunsignedlong omap_cpcap_vsel_to_uv(unsignedchar vsel)
{ if (vsel > 0x44)
vsel = 0x44; return (((vsel * 125) + 6000)) * 100;
}
/** * omap_cpcap_uv_to_vsel - convert microvolts DC to CPCAP VSEL value * @uv: microvolts DC to convert * * Returns: the VSEL value necessary for the CPCAP PMIC to * generate an output voltage equal to or greater than @uv microvolts DC.
*/ staticunsignedchar omap_cpcap_uv_to_vsel(unsignedlong uv)
{ if (uv < 600000)
uv = 600000; elseif (uv > 1450000)
uv = 1450000; return DIV_ROUND_UP(uv - 600000, 12500);
}
/** * omap_max8952_vsel_to_uv - convert MAX8952 VSEL value to microvolts DC * @vsel: MAX8952 VSEL value to convert * * Returns: the microvolts DC that the MAX8952 Regulator should generate when * programmed with @vsel.
*/ staticunsignedlong omap_max8952_vsel_to_uv(unsignedchar vsel)
{ if (vsel > 0x3F)
vsel = 0x3F; return (((vsel * 100) + 7700)) * 100;
}
/** * omap_max8952_uv_to_vsel - convert microvolts DC to MAX8952 VSEL value * @uv: microvolts DC to convert * * Returns: the VSEL value necessary for the MAX8952 Regulator to * generate an output voltage equal to or greater than @uv microvolts DC.
*/ staticunsignedchar omap_max8952_uv_to_vsel(unsignedlong uv)
{ if (uv < 770000)
uv = 770000; elseif (uv > 1400000)
uv = 1400000; return DIV_ROUND_UP(uv - 770000, 10000);
}
/** * omap_fan535503_vsel_to_uv - convert FAN535503 VSEL value to microvolts DC * @vsel: FAN535503 VSEL value to convert * * Returns: the microvolts DC that the FAN535503 Regulator should generate when * programmed with @vsel.
*/ staticunsignedlong omap_fan535503_vsel_to_uv(unsignedchar vsel)
{ /* Extract bits[5:0] */
vsel &= 0x3F;
return (((vsel * 125) + 7500)) * 100;
}
/** * omap_fan535508_vsel_to_uv - convert FAN535508 VSEL value to microvolts DC * @vsel: FAN535508 VSEL value to convert * * Returns: the microvolts DC that the FAN535508 Regulator should generate when * programmed with @vsel.
*/ staticunsignedlong omap_fan535508_vsel_to_uv(unsignedchar vsel)
{ /* Extract bits[5:0] */
vsel &= 0x3F;
/** * omap_fan535503_uv_to_vsel - convert microvolts DC to FAN535503 VSEL value * @uv: microvolts DC to convert * * Returns: the VSEL value necessary for the MAX8952 Regulator to * generate an output voltage equal to or greater than @uv microvolts DC.
*/ staticunsignedchar omap_fan535503_uv_to_vsel(unsignedlong uv)
{ unsignedchar vsel; if (uv < 750000)
uv = 750000; elseif (uv > 1537500)
uv = 1537500;
/** * omap_fan535508_uv_to_vsel - convert microvolts DC to FAN535508 VSEL value * @uv: microvolts DC to convert * * Returns: the VSEL value necessary for the MAX8952 Regulator to * generate an output voltage equal to or greater than @uv microvolts DC.
*/ staticunsignedchar omap_fan535508_uv_to_vsel(unsignedlong uv)
{ unsignedchar vsel; if (uv < 750000)
uv = 750000; elseif (uv > 1437500)
uv = 1437500;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.