@@ -573,7 +573,7 @@ EXPORT_SYMBOL_GPL(mtk_pinconf_bias_get_rev1);
573573 */
574574static int mtk_pinconf_bias_set_pu_pd (struct mtk_pinctrl * hw ,
575575 const struct mtk_pin_desc * desc ,
576- u32 pullup , u32 arg )
576+ u32 pullup , u32 arg , bool pd_only )
577577{
578578 int err , pu , pd ;
579579
@@ -587,18 +587,34 @@ static int mtk_pinconf_bias_set_pu_pd(struct mtk_pinctrl *hw,
587587 pu = 0 ;
588588 pd = 1 ;
589589 } else {
590- err = - EINVAL ;
591- goto out ;
590+ return - EINVAL ;
592591 }
593592
594- err = mtk_hw_set_value (hw , desc , PINCTRL_PIN_REG_PU , pu );
595- if (err )
596- goto out ;
593+ if (!pd_only ) {
594+ err = mtk_hw_set_value (hw , desc , PINCTRL_PIN_REG_PU , pu );
595+ if (err )
596+ return err ;
597+ }
597598
598- err = mtk_hw_set_value (hw , desc , PINCTRL_PIN_REG_PD , pd );
599+ return mtk_hw_set_value (hw , desc , PINCTRL_PIN_REG_PD , pd );
600+ }
601+
602+ static int mtk_pinconf_bias_set_pd (struct mtk_pinctrl * hw ,
603+ const struct mtk_pin_desc * desc ,
604+ u32 pullup , u32 arg )
605+ {
606+ int err , pd ;
607+
608+ if (arg != MTK_DISABLE && arg != MTK_ENABLE )
609+ return - EINVAL ;
610+
611+ if (arg == MTK_DISABLE || pullup )
612+ pd = 0 ;
613+ else if (!pullup )
614+ pd = 1 ;
615+
616+ return mtk_hw_set_value (hw , desc , PINCTRL_PIN_REG_PD , pd );
599617
600- out :
601- return err ;
602618}
603619
604620static int mtk_pinconf_bias_set_pullsel_pullen (struct mtk_pinctrl * hw ,
@@ -737,7 +753,7 @@ static int mtk_pinconf_bias_set_pu_pd_rsel(struct mtk_pinctrl *hw,
737753 return err ;
738754 }
739755
740- return mtk_pinconf_bias_set_pu_pd (hw , desc , pullup , enable );
756+ return mtk_pinconf_bias_set_pu_pd (hw , desc , pullup , enable , false );
741757}
742758
743759int mtk_pinconf_bias_set_combo (struct mtk_pinctrl * hw ,
@@ -758,8 +774,14 @@ int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw,
758774 return 0 ;
759775 }
760776
777+ if (try_all_type & MTK_PULL_PD_TYPE ) {
778+ err = mtk_pinconf_bias_set_pu_pd (hw , desc , pullup , arg , true);
779+ if (!err )
780+ return err ;
781+ }
782+
761783 if (try_all_type & MTK_PULL_PU_PD_TYPE ) {
762- err = mtk_pinconf_bias_set_pu_pd (hw , desc , pullup , arg );
784+ err = mtk_pinconf_bias_set_pu_pd (hw , desc , pullup , arg , false );
763785 if (!err )
764786 return 0 ;
765787 }
@@ -878,6 +900,29 @@ static int mtk_pinconf_bias_get_pu_pd(struct mtk_pinctrl *hw,
878900 return err ;
879901}
880902
903+ static int mtk_pinconf_bias_get_pd (struct mtk_pinctrl * hw ,
904+ const struct mtk_pin_desc * desc ,
905+ u32 * pullup , u32 * enable )
906+ {
907+ int err , pd ;
908+
909+ err = mtk_hw_get_value (hw , desc , PINCTRL_PIN_REG_PD , & pd );
910+ if (err )
911+ goto out ;
912+
913+ if (pd == 0 ) {
914+ * pullup = 0 ;
915+ * enable = MTK_DISABLE ;
916+ } else if (pd == 1 ) {
917+ * pullup = 0 ;
918+ * enable = MTK_ENABLE ;
919+ } else
920+ err = - EINVAL ;
921+
922+ out :
923+ return err ;
924+ }
925+
881926static int mtk_pinconf_bias_get_pullsel_pullen (struct mtk_pinctrl * hw ,
882927 const struct mtk_pin_desc * desc ,
883928 u32 * pullup , u32 * enable )
@@ -947,6 +992,12 @@ int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw,
947992 return 0 ;
948993 }
949994
995+ if (try_all_type & MTK_PULL_PD_TYPE ) {
996+ err = mtk_pinconf_bias_get_pd (hw , desc , pullup , enable );
997+ if (!err )
998+ return err ;
999+ }
1000+
9501001 if (try_all_type & MTK_PULL_PU_PD_TYPE ) {
9511002 err = mtk_pinconf_bias_get_pu_pd (hw , desc , pullup , enable );
9521003 if (!err )
0 commit comments