@@ -608,86 +608,6 @@ static const struct iio_enum stm32_enable_mode_enum = {
608608 .get = stm32_get_enable_mode
609609};
610610
611- static const char * const stm32_quadrature_modes [] = {
612- "channel_A" ,
613- "channel_B" ,
614- "quadrature" ,
615- };
616-
617- static int stm32_set_quadrature_mode (struct iio_dev * indio_dev ,
618- const struct iio_chan_spec * chan ,
619- unsigned int mode )
620- {
621- struct stm32_timer_trigger * priv = iio_priv (indio_dev );
622-
623- regmap_update_bits (priv -> regmap , TIM_SMCR , TIM_SMCR_SMS , mode + 1 );
624-
625- return 0 ;
626- }
627-
628- static int stm32_get_quadrature_mode (struct iio_dev * indio_dev ,
629- const struct iio_chan_spec * chan )
630- {
631- struct stm32_timer_trigger * priv = iio_priv (indio_dev );
632- u32 smcr ;
633- int mode ;
634-
635- regmap_read (priv -> regmap , TIM_SMCR , & smcr );
636- mode = (smcr & TIM_SMCR_SMS ) - 1 ;
637- if ((mode < 0 ) || (mode > ARRAY_SIZE (stm32_quadrature_modes )))
638- return - EINVAL ;
639-
640- return mode ;
641- }
642-
643- static const struct iio_enum stm32_quadrature_mode_enum = {
644- .items = stm32_quadrature_modes ,
645- .num_items = ARRAY_SIZE (stm32_quadrature_modes ),
646- .set = stm32_set_quadrature_mode ,
647- .get = stm32_get_quadrature_mode
648- };
649-
650- static const char * const stm32_count_direction_states [] = {
651- "up" ,
652- "down"
653- };
654-
655- static int stm32_set_count_direction (struct iio_dev * indio_dev ,
656- const struct iio_chan_spec * chan ,
657- unsigned int dir )
658- {
659- struct stm32_timer_trigger * priv = iio_priv (indio_dev );
660- u32 val ;
661- int mode ;
662-
663- /* In encoder mode, direction is RO (given by TI1/TI2 signals) */
664- regmap_read (priv -> regmap , TIM_SMCR , & val );
665- mode = (val & TIM_SMCR_SMS ) - 1 ;
666- if ((mode >= 0 ) || (mode < ARRAY_SIZE (stm32_quadrature_modes )))
667- return - EBUSY ;
668-
669- return regmap_update_bits (priv -> regmap , TIM_CR1 , TIM_CR1_DIR ,
670- dir ? TIM_CR1_DIR : 0 );
671- }
672-
673- static int stm32_get_count_direction (struct iio_dev * indio_dev ,
674- const struct iio_chan_spec * chan )
675- {
676- struct stm32_timer_trigger * priv = iio_priv (indio_dev );
677- u32 cr1 ;
678-
679- regmap_read (priv -> regmap , TIM_CR1 , & cr1 );
680-
681- return ((cr1 & TIM_CR1_DIR ) ? 1 : 0 );
682- }
683-
684- static const struct iio_enum stm32_count_direction_enum = {
685- .items = stm32_count_direction_states ,
686- .num_items = ARRAY_SIZE (stm32_count_direction_states ),
687- .set = stm32_set_count_direction ,
688- .get = stm32_get_count_direction
689- };
690-
691611static ssize_t stm32_count_get_preset (struct iio_dev * indio_dev ,
692612 uintptr_t private ,
693613 const struct iio_chan_spec * chan ,
@@ -728,10 +648,6 @@ static const struct iio_chan_spec_ext_info stm32_trigger_count_info[] = {
728648 .read = stm32_count_get_preset ,
729649 .write = stm32_count_set_preset
730650 },
731- IIO_ENUM ("count_direction" , IIO_SEPARATE , & stm32_count_direction_enum ),
732- IIO_ENUM_AVAILABLE ("count_direction" , & stm32_count_direction_enum ),
733- IIO_ENUM ("quadrature_mode" , IIO_SEPARATE , & stm32_quadrature_mode_enum ),
734- IIO_ENUM_AVAILABLE ("quadrature_mode" , & stm32_quadrature_mode_enum ),
735651 IIO_ENUM ("enable_mode" , IIO_SEPARATE , & stm32_enable_mode_enum ),
736652 IIO_ENUM_AVAILABLE ("enable_mode" , & stm32_enable_mode_enum ),
737653 IIO_ENUM ("trigger_mode" , IIO_SEPARATE , & stm32_trigger_mode_enum ),
0 commit comments