@@ -20,15 +20,13 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL);
2020 * to 0 or 1, hence the use of #if IS_ENABLED(). 
2121 */ 
2222#if  IS_ENABLED (NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED )
23- #define  ANOMALY_109_IRQ_CONNECT (...) IRQ_CONNECT(__VA_ARGS__)
2423#define  ANOMALY_109_EGU_IRQ_CONNECT (idx ) _EGU_IRQ_CONNECT(idx)
2524#define  _EGU_IRQ_CONNECT (idx ) \
2625	extern void nrfx_egu_##idx##_irq_handler(void); \
2726	IRQ_CONNECT(DT_IRQN(DT_NODELABEL(egu##idx)), \
2827		    DT_IRQ(DT_NODELABEL(egu##idx), priority), \
2928		    nrfx_isr, nrfx_egu_##idx##_irq_handler, 0)
3029#else 
31- #define  ANOMALY_109_IRQ_CONNECT (...)
3230#define  ANOMALY_109_EGU_IRQ_CONNECT (idx )
3331#endif 
3432
@@ -63,6 +61,12 @@ static uint16_t *seq_values_ptr_get(const struct device *dev)
6361	return  (uint16_t  * )config -> seq .values .p_raw ;
6462}
6563
64+ static  void  pwm_handler (nrfx_pwm_evt_type_t  event_type , void  * p_context )
65+ {
66+ 	ARG_UNUSED (event_type );
67+ 	ARG_UNUSED (p_context );
68+ }
69+ 
6670static  bool  pwm_period_check_and_set (const  struct  device  * dev ,
6771				     uint32_t  channel , uint32_t  period_cycles )
6872{
@@ -229,7 +233,8 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel,
229233		 * until another playback is requested (new values will be 
230234		 * loaded then) or the PWM peripheral is stopped. 
231235		 */ 
232- 		nrfx_pwm_simple_playback (& config -> pwm , & config -> seq , 1 , 0 );
236+ 		nrfx_pwm_simple_playback (& config -> pwm , & config -> seq , 1 ,
237+ 					 NRFX_PWM_FLAG_NO_EVT_FINISHED );
233238	}
234239
235240	return  0 ;
@@ -256,6 +261,7 @@ static int pwm_nrfx_init(const struct device *dev)
256261{
257262	const  struct  pwm_nrfx_config  * config  =  dev -> config ;
258263	uint8_t  initially_inverted  =  0 ;
264+ 	nrfx_err_t  result ;
259265
260266	int  ret  =  pinctrl_apply_state (config -> pcfg , PINCTRL_STATE_DEFAULT );
261267
@@ -284,10 +290,7 @@ static int pwm_nrfx_init(const struct device *dev)
284290		seq_values_ptr_get (dev )[i ] =  PWM_NRFX_CH_VALUE (0 , inverted );
285291	}
286292
287- 	nrfx_err_t  result  =  nrfx_pwm_init (& config -> pwm ,
288- 					  & config -> initial_config ,
289- 					  NULL ,
290- 					  NULL );
293+ 	result  =  nrfx_pwm_init (& config -> pwm , & config -> initial_config , pwm_handler , dev -> data );
291294	if  (result  !=  NRFX_SUCCESS ) {
292295		LOG_ERR ("Failed to initialize device: %s" , dev -> name );
293296		return  - EBUSY ;
@@ -377,9 +380,8 @@ static int pwm_nrfx_pm_action(const struct device *dev,
377380	};								      \
378381	static int pwm_nrfx_init##idx(const struct device *dev)		      \
379382	{								      \
380- 		ANOMALY_109_IRQ_CONNECT(				      \
381- 			DT_IRQN(PWM(idx)), DT_IRQ(PWM(idx), priority),	      \
382- 			nrfx_isr, nrfx_pwm_##idx##_irq_handler, 0);	      \
383+ 		IRQ_CONNECT(DT_IRQN(PWM(idx)), DT_IRQ(PWM(idx), priority),    \
384+ 			    nrfx_isr, nrfx_pwm_##idx##_irq_handler, 0);	      \
383385		return pwm_nrfx_init(dev);				      \
384386	};								      \
385387	PM_DEVICE_DT_DEFINE(PWM(idx), pwm_nrfx_pm_action);		      \
0 commit comments