@@ -549,6 +549,32 @@ static int quad8_index_polarity_set(struct counter_device *counter,
549549 return 0 ;
550550}
551551
552+ static int quad8_polarity_read (struct counter_device * counter ,
553+ struct counter_signal * signal ,
554+ enum counter_signal_polarity * polarity )
555+ {
556+ int err ;
557+ u32 index_polarity ;
558+
559+ err = quad8_index_polarity_get (counter , signal , & index_polarity );
560+ if (err )
561+ return err ;
562+
563+ * polarity = (index_polarity ) ? COUNTER_SIGNAL_POLARITY_POSITIVE :
564+ COUNTER_SIGNAL_POLARITY_NEGATIVE ;
565+
566+ return 0 ;
567+ }
568+
569+ static int quad8_polarity_write (struct counter_device * counter ,
570+ struct counter_signal * signal ,
571+ enum counter_signal_polarity polarity )
572+ {
573+ const u32 pol = (polarity == COUNTER_SIGNAL_POLARITY_POSITIVE ) ? 1 : 0 ;
574+
575+ return quad8_index_polarity_set (counter , signal , pol );
576+ }
577+
552578static const char * const quad8_synchronous_modes [] = {
553579 "non-synchronous" ,
554580 "synchronous"
@@ -977,13 +1003,22 @@ static struct counter_comp quad8_signal_ext[] = {
9771003 quad8_signal_fck_prescaler_write )
9781004};
9791005
1006+ static const enum counter_signal_polarity quad8_polarities [] = {
1007+ COUNTER_SIGNAL_POLARITY_POSITIVE ,
1008+ COUNTER_SIGNAL_POLARITY_NEGATIVE ,
1009+ };
1010+
1011+ static DEFINE_COUNTER_AVAILABLE (quad8_polarity_available , quad8_polarities ) ;
1012+
9801013static DEFINE_COUNTER_ENUM (quad8_index_pol_enum , quad8_index_polarity_modes ) ;
9811014static DEFINE_COUNTER_ENUM (quad8_synch_mode_enum , quad8_synchronous_modes ) ;
9821015
9831016static struct counter_comp quad8_index_ext [] = {
9841017 COUNTER_COMP_SIGNAL_ENUM ("index_polarity" , quad8_index_polarity_get ,
9851018 quad8_index_polarity_set ,
9861019 quad8_index_pol_enum ),
1020+ COUNTER_COMP_POLARITY (quad8_polarity_read , quad8_polarity_write ,
1021+ quad8_polarity_available ),
9871022 COUNTER_COMP_SIGNAL_ENUM ("synchronous_mode" , quad8_synchronous_mode_get ,
9881023 quad8_synchronous_mode_set ,
9891024 quad8_synch_mode_enum ),
0 commit comments