Skip to content

Commit 55fc826

Browse files
Dat-NguyenDuymmahadevan108
authored andcommitted
drivers: emios_pwm: do not configure period, duty and polarity at boot
Removing period, duty and polarity configuration from channel devicetree. At boot time, only minimal setup like pinctrl, prescaler, etc should be initialized. PWM signal is produced by using pwm_set* API Also after this change, PWM period, duty are changed at the next counter period boundary Signed-off-by: Dat Nguyen Duy <[email protected]>
1 parent 2a6e590 commit 55fc826

File tree

6 files changed

+318
-267
lines changed

6 files changed

+318
-267
lines changed

boards/nxp/mr_canhubk3/mr_canhubk3.dts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@
499499
emios0_bus_a {
500500
mode = "MCB_UP_COUNTER";
501501
prescaler = <16>;
502-
period = <1000>;
503502
status = "okay";
504503
};
505504
};
@@ -513,63 +512,43 @@
513512
pwm_0 {
514513
channel = <0>;
515514
pwm-mode = "OPWFMB";
516-
period = <65535>;
517-
duty-cycle = <0>;
518515
prescaler = <8>;
519-
polarity = "ACTIVE_HIGH";
520516
};
521517

522518
pwm_1 {
523519
channel = <1>;
524520
pwm-mode = "OPWFMB";
525-
period = <65535>;
526-
duty-cycle = <0>;
527521
prescaler = <8>;
528-
polarity = "ACTIVE_HIGH";
529522
};
530523

531524
pwm_2 {
532525
channel = <2>;
533526
pwm-mode = "OPWFMB";
534-
period = <65535>;
535-
duty-cycle = <0>;
536527
prescaler = <8>;
537-
polarity = "ACTIVE_HIGH";
538528
};
539529

540530
pwm_3 {
541531
channel = <3>;
542532
pwm-mode = "OPWFMB";
543-
period = <65535>;
544-
duty-cycle = <0>;
545533
prescaler = <8>;
546-
polarity = "ACTIVE_HIGH";
547534
};
548535

549536
pwm_4 {
550537
channel = <4>;
551538
pwm-mode = "OPWFMB";
552-
period = <65535>;
553-
duty-cycle = <0>;
554539
prescaler = <8>;
555-
polarity = "ACTIVE_HIGH";
556540
};
557541

558542
pwm_5 {
559543
channel = <5>;
560544
pwm-mode = "OPWFMB";
561-
period = <65535>;
562-
duty-cycle = <0>;
563545
prescaler = <8>;
564-
polarity = "ACTIVE_HIGH";
565546
};
566547

567548
rgb_red {
568549
channel = <19>;
569550
master-bus = <&emios0_bus_a>;
570-
duty-cycle = <0>;
571551
pwm-mode = "OPWMB";
572-
polarity = "ACTIVE_LOW";
573552
};
574553
};
575554
};
@@ -586,14 +565,12 @@
586565
emios1_bus_a {
587566
prescaler = <16>;
588567
mode = "MCB_UP_COUNTER";
589-
period = <1000>;
590568
status = "okay";
591569
};
592570

593571
emios1_bus_f {
594572
prescaler = <16>;
595573
mode = "MCB_UP_COUNTER";
596-
period = <1000>;
597574
status = "okay";
598575
};
599576
};
@@ -606,17 +583,13 @@
606583
rgb_green {
607584
channel = <10>;
608585
master-bus = <&emios1_bus_a>;
609-
duty-cycle = <0>;
610586
pwm-mode = "OPWMB";
611-
polarity = "ACTIVE_LOW";
612587
};
613588

614589
rgb_blue {
615590
channel = <5>;
616591
master-bus = <&emios1_bus_f>;
617-
duty-cycle = <0>;
618592
pwm-mode = "OPWMB";
619-
polarity = "ACTIVE_LOW";
620593
};
621594
};
622595
};

drivers/misc/nxp_s32_emios/nxp_s32_emios.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,17 @@ static int nxp_s32_emios_init(const struct device *dev)
5959
.enableGlobalTimeBase = true \
6060
};
6161

62-
#define NXP_S32_EMIOS_MASTER_BUS_VERIFY(node_id) \
63-
BUILD_ASSERT(IN_RANGE(DT_PROP(node_id, period), \
64-
MIN_MASTER_BUS_PERIOD, MAX_MASTER_BUS_PERIOD), \
65-
"Node "DT_NODE_PATH(node_id)": period is out of range");
66-
6762
#define NXP_S32_EMIOS_MASTER_BUS_CONFIG(node_id) \
6863
{ \
6964
.hwChannel = DT_PROP(node_id, channel), \
70-
.defaultPeriod = DT_PROP(node_id, period), \
65+
.defaultPeriod = MAX_MASTER_BUS_PERIOD, \
7166
.masterBusPrescaler = DT_PROP(node_id, prescaler) - 1, \
7267
.allowDebugMode = DT_PROP(node_id, freeze), \
7368
.masterMode = NXP_S32_EMIOS_MASTER_BUS_MODE(DT_STRING_TOKEN(node_id, mode)), \
7469
.masterBusAltPrescaler = 0, \
7570
},
7671

7772
#define NXP_S32_EMIOS_GENERATE_MASTER_BUS_CONFIG(n) \
78-
DT_FOREACH_CHILD_STATUS_OKAY(DT_INST_CHILD(n, master_bus), \
79-
NXP_S32_EMIOS_MASTER_BUS_VERIFY) \
8073
const Emios_Ip_MasterBusConfigType nxp_s32_emios_##n##_master_bus_config[] = { \
8174
DT_FOREACH_CHILD_STATUS_OKAY(DT_INST_CHILD(n, master_bus), \
8275
NXP_S32_EMIOS_MASTER_BUS_CONFIG) \

0 commit comments

Comments
 (0)