pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear
Subsystems (2)
PATCH 1/2 pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear
Current implementation in dove_audio1_ctrl_set() does not clear corresponding register bit if BIT(0|1|2|3) of config is clear. Fix it.
---
Hi,
I don't have this hardware.
I'd appreciate if someone can review and test this patch.
Thanks,
Axel
drivers/pinctrl/mvebu/pinctrl-dove.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/pinctrl/mvebu/pinctrl-dove.c +11 -0
@@ -236,12 +236,23 @@ static int dove_audio1_ctrl_set(struct mvebu_mpp_ctrl *ctrl,if (config &BIT (0 )) gcfg2 |=DOVE_TWSI_OPTION3_GPIO ; +else + gcfg2 &= ~DOVE_TWSI_OPTION3_GPIO ; +if (config &BIT (1 )) gmpp |=DOVE_AU1_SPDIFO_GPIO_EN ; +else + gmpp &= ~DOVE_AU1_SPDIFO_GPIO_EN ; +if (config &BIT (2 )) sspc1 |=DOVE_SSP_ON_AU1 ; +else + sspc1 &= ~DOVE_SSP_ON_AU1 ; +if (config &BIT (3 )) mpp4 |=DOVE_AU1_GPIO_SEL ; +else + mpp4 &= ~DOVE_AU1_GPIO_SEL ;writel (mpp4,DOVE_MPP_CTRL4_VIRT_BASE );writel (sspc1,DOVE_SSP_CTRL_STATUS_1 );
Signature · 1 line
1.7.9.5
PATCH 2/2 pinctrl: dove: Checking valid config in dove_audio1_ctrl_set
Move the code checking valid config to dove_audio1_ctrl_set(), this ensures we always set valid config. And then dove_audio1_ctrl_get() always returns correct config.
--- drivers/pinctrl/mvebu/pinctrl-dove.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/pinctrl/mvebu/pinctrl-dove.c +7 -6
@@ -217,12 +217,6 @@ static int dove_audio1_ctrl_get(struct mvebu_mpp_ctrl *ctrl,if (gcfg2 &DOVE_TWSI_OPTION3_GPIO ) *config |=BIT (0 ); -/* SSP/TWSI only if I2S1 not set*/ -if ((*config &BIT (3 )) ==0 ) - *config &= ~(BIT (2 ) |BIT (0 )); -/* TWSI only if SPDIFO not set*/ -if ((*config &BIT (1 )) ==0 ) - *config &= ~BIT (0 );return 0 ; }
@@ -234,6 +228,13 @@ static int dove_audio1_ctrl_set(struct mvebu_mpp_ctrl *ctrl,unsigned long gmpp =readl (DOVE_MPP_GENERAL_VIRT_BASE );unsigned long gcfg2 =readl (DOVE_GLOBAL_CONFIG_2 ); +/* SSP/TWSI only if I2S1 not set*/ +if ((config &BIT (3 )) ==0 ) + config &= ~(BIT (2 ) |BIT (0 )); +/* TWSI only if SPDIFO not set*/ +if ((config &BIT (1 )) ==0 ) + config &= ~BIT (0 ); +if (config &BIT (0 )) gcfg2 |=DOVE_TWSI_OPTION3_GPIO ;else
Signature · 1 line
1.7.9.5
Axel,
Quoted 9 lines · Axel Lin
Current implementation in
dove_audio1_ctrl_set()does not clear corresponding register bit if BIT(0|1|2|3) of config is clear. Fix it.Signed-off-by Axel Lin <[email protected]>---
Hi,
I don't have this hardware.
I'd appreciate if someone can review and test this patch.
Quoted 4 lines
Thanks,
Axeldrivers/pinctrl/mvebu/pinctrl-dove.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
The patches against pinctrl-dove need to be reviewed and acked by Sebastian Hesselbarth, he is the one who has written this code and who has access to Dove hardware. Could you repost and Cc him, as well as linux-arm-kernel@ ?
Best regards,
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com