@@ -91,6 +91,11 @@ static const char *const counter_count_mode_str[] = {
9191 [COUNTER_COUNT_MODE_MODULO_N ] = "modulo-n"
9292};
9393
94+ static const char * const counter_signal_polarity_str [] = {
95+ [COUNTER_SIGNAL_POLARITY_POSITIVE ] = "positive" ,
96+ [COUNTER_SIGNAL_POLARITY_NEGATIVE ] = "negative"
97+ };
98+
9499static ssize_t counter_comp_u8_show (struct device * dev ,
95100 struct device_attribute * attr , char * buf )
96101{
@@ -201,6 +206,8 @@ static ssize_t counter_comp_u32_show(struct device *dev,
201206 return sysfs_emit (buf , "%s\n" , counter_count_direction_str [data ]);
202207 case COUNTER_COMP_COUNT_MODE :
203208 return sysfs_emit (buf , "%s\n" , counter_count_mode_str [data ]);
209+ case COUNTER_COMP_SIGNAL_POLARITY :
210+ return sysfs_emit (buf , "%s\n" , counter_signal_polarity_str [data ]);
204211 default :
205212 return sysfs_emit (buf , "%u\n" , (unsigned int )data );
206213 }
@@ -252,6 +259,10 @@ static ssize_t counter_comp_u32_store(struct device *dev,
252259 err = counter_find_enum (& data , avail -> enums , avail -> num_items ,
253260 buf , counter_count_mode_str );
254261 break ;
262+ case COUNTER_COMP_SIGNAL_POLARITY :
263+ err = counter_find_enum (& data , avail -> enums , avail -> num_items ,
264+ buf , counter_signal_polarity_str );
265+ break ;
255266 default :
256267 err = kstrtou32 (buf , 0 , & data );
257268 break ;
@@ -469,6 +480,7 @@ static int counter_attr_create(struct device *const dev,
469480 case COUNTER_COMP_ENUM :
470481 case COUNTER_COMP_COUNT_DIRECTION :
471482 case COUNTER_COMP_COUNT_MODE :
483+ case COUNTER_COMP_SIGNAL_POLARITY :
472484 if (comp -> device_u32_read ) {
473485 dev_attr -> attr .mode |= 0444 ;
474486 dev_attr -> show = counter_comp_u32_show ;
0 commit comments