Skip to content

Commit

Permalink
Merge pull request #132 from aasinclair/update-soft-start-values
Browse files Browse the repository at this point in the history
Remove soft start value workaround and add soft start to overlay
  • Loading branch information
kylebonnici authored Feb 2, 2024
2 parents 3d21d66 + 6fc24f9 commit 316c16c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/components/Cards/LDO/LDOCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ interface LdoCardProperties {
defaultSummary?: boolean;
}

const tempSoftStartValues = [10, 20, 35, 50];
const softStartItems = SoftStartValues.map((item, index) => ({
label: `${tempSoftStartValues[index]} mA`,
const softStartItems = SoftStartValues.map(item => ({
label: `${item} mA`,
value: `${item}`,
}));

Expand Down
2 changes: 1 addition & 1 deletion src/features/pmicControl/npm/npm1300/ldo/ldoCallbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const setupSingleLdo = (

cleanupCallbacks.push(
shellParser.registerCommandCallback(
toRegex('npmx ldsw soft_start current', true, i, '(25|50|75|100)'),
toRegex('npmx ldsw soft_start current', true, i, '(10|20|35|50)'),
res => {
eventEmitter.emitPartialEvent<Ldo>(
'onLdoUpdate',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('PMIC 1300 - Apply Config ', () => {
mode: 'LDO',
enabled: true,
softStartEnabled: true,
softStart: 25,
softStart: 20,
activeDischarge: false,
onOffControl: 'GPIO0',
};
Expand Down Expand Up @@ -158,7 +158,7 @@ describe('PMIC 1300 - Apply Config ', () => {
mode: 'ldoSwitch',
enabled: false,
softStartEnabled: false,
softStart: 100,
softStart: 50,
activeDischarge: false,
onOffControl: 'GPIO2',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ describe('PMIC 1300 - Setters Offline tests', () => {
);

test.each(PMIC_1300_LDOS)('Set setLdoSoftStart index: %p', async index => {
await pmic.setLdoSoftStart(index, 25);
await pmic.setLdoSoftStart(index, 20);

expect(mockOnLdoUpdate).toBeCalledTimes(1);
expect(mockOnLdoUpdate).toBeCalledWith({
data: { softStart: 25 },
data: { softStart: 20 },
index,
});
});
Expand Down
2 changes: 2 additions & 0 deletions src/features/pmicControl/npm/overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from '../types';

const toMicro = (value: number) => value * 1000000;
const toMilli = (value: number) => value * 1000;

const thermistorTypeToOverlay = (value: NTCThermistor) => {
switch (value) {
Expand Down Expand Up @@ -118,6 +119,7 @@ npm1300_ek_ldo${index + 1}: LDO${index + 1} {
regulator-initial-mode = <${
ldo.mode === 'LDO' ? 'NPM1300_LDSW_MODE_LDO' : 'NPM1300_LDSW_MODE_LDSW'
}>;
// soft-start-microamp = <${toMilli(ldo.softStart)}>;
${
ldo.onOffControl !== 'SW'
? `enable-gpios = <&npm1300_ek_gpio ${GPIOValues.findIndex(
Expand Down
2 changes: 1 addition & 1 deletion src/features/pmicControl/npm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const BuckRetentionControlValues = ['Off'] as const;
type GPIONames = (typeof GPIOValues)[number];
export type RebootMode = 'cold' | 'warm';
export type LdoMode = 'ldoSwitch' | 'LDO';
export const SoftStartValues = [25, 50, 75, 100] as const;
export const SoftStartValues = [10, 20, 35, 50] as const;
export type SoftStart = (typeof SoftStartValues)[number];
export type LdoOnOffControl =
| (typeof LdoOnOffControlValues)[number]
Expand Down
2 changes: 1 addition & 1 deletion src/features/pmicControl/npm/useNpmDevice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export default () => {
mode: 'ldoSwitch',
enabled: false,
softStartEnabled: true,
softStart: 25,
softStart: 20,
activeDischarge: false,
onOffControl: 'SW',
});
Expand Down

0 comments on commit 316c16c

Please sign in to comment.