linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear
@ 2012-11-11 13:44 Axel Lin
  2012-11-11 13:46 ` [PATCH RFT 2/2] pinctrl: dove: Checking valid config in dove_audio1_ctrl_set Axel Lin
  2012-11-12  9:39 ` [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear Sebastian Hesselbarth
  0 siblings, 2 replies; 7+ messages in thread
From: Axel Lin @ 2012-11-11 13:44 UTC (permalink / raw)
  To: linux-arm-kernel

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 <axel.lin@ingics.com>
---
Hi,
I don't have this hardware.
I'd appreciate if someone can review and test this patch.

This resend also CC Sebastian Hesselbarth and linux-arm-kernel.
Thanks,
Axel
 drivers/pinctrl/mvebu/pinctrl-dove.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c
index ffe74b2..e5cc694 100644
--- a/drivers/pinctrl/mvebu/pinctrl-dove.c
+++ b/drivers/pinctrl/mvebu/pinctrl-dove.c
@@ -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);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH RFT 2/2] pinctrl: dove: Checking valid config in dove_audio1_ctrl_set
  2012-11-11 13:44 [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear Axel Lin
@ 2012-11-11 13:46 ` Axel Lin
  2012-11-12  9:43   ` Sebastian Hesselbarth
  2012-11-12  9:39 ` [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear Sebastian Hesselbarth
  1 sibling, 1 reply; 7+ messages in thread
From: Axel Lin @ 2012-11-11 13:46 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/pinctrl/mvebu/pinctrl-dove.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c
index e5cc694..a393790 100644
--- a/drivers/pinctrl/mvebu/pinctrl-dove.c
+++ b/drivers/pinctrl/mvebu/pinctrl-dove.c
@@ -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
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear
  2012-11-11 13:44 [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear Axel Lin
  2012-11-11 13:46 ` [PATCH RFT 2/2] pinctrl: dove: Checking valid config in dove_audio1_ctrl_set Axel Lin
@ 2012-11-12  9:39 ` Sebastian Hesselbarth
  2012-11-16  9:12   ` Axel Lin
  1 sibling, 1 reply; 7+ messages in thread
From: Sebastian Hesselbarth @ 2012-11-12  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/11/2012 02:44 PM, Axel Lin wrote:
> 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<axel.lin@ingics.com>

Axel,

thanks for the hint on not clearing the audio1 bits before setting them.
I will test this tonight and guess you should prepare a real patch for
this one.

Sebastian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH RFT 2/2] pinctrl: dove: Checking valid config in dove_audio1_ctrl_set
  2012-11-11 13:46 ` [PATCH RFT 2/2] pinctrl: dove: Checking valid config in dove_audio1_ctrl_set Axel Lin
@ 2012-11-12  9:43   ` Sebastian Hesselbarth
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Hesselbarth @ 2012-11-12  9:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/11/2012 02:46 PM, Axel Lin wrote:
> 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.
>
> Signed-off-by: Axel Lin<axel.lin@ingics.com>

Axel,

although correct in a software point-of-view, I don't think we should move this
from _get to _set because the hardware allows to set these bits without changing
the actual function. There are some dominant bits in this settings so the masking
is done to not have ~5 different values for the same function here.

The pinctrl driver will set one of the (software) supported values anyway but on
reset there could be one of the values mentioned above written into the registers.

Sebastian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear
  2012-11-12  9:39 ` [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear Sebastian Hesselbarth
@ 2012-11-16  9:12   ` Axel Lin
  2012-11-16 18:32     ` Sebastian Hesselbarth
  0 siblings, 1 reply; 7+ messages in thread
From: Axel Lin @ 2012-11-16  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

2012/11/12 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>:
> On 11/11/2012 02:44 PM, Axel Lin wrote:
>>
>> 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<axel.lin@ingics.com>
>
>
> Axel,
>
> thanks for the hint on not clearing the audio1 bits before setting them.
> I will test this tonight and guess you should prepare a real patch for
> this one.

Hi Sebastian,
Does this patch work for you?
May I have your Acked-and-Tested-by if you think this patch is ok.

Thanks,
Axel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear
  2012-11-16  9:12   ` Axel Lin
@ 2012-11-16 18:32     ` Sebastian Hesselbarth
  2012-11-17  1:22       ` Axel Lin
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastian Hesselbarth @ 2012-11-16 18:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/16/2012 10:12 AM, Axel Lin wrote:
> 2012/11/12 Sebastian Hesselbarth<sebastian.hesselbarth@gmail.com>:
>> On 11/11/2012 02:44 PM, Axel Lin wrote:
>>>
>>> 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<axel.lin@ingics.com>
>>
>>
>> Axel,
>>
>> thanks for the hint on not clearing the audio1 bits before setting them.
>> I will test this tonight and guess you should prepare a real patch for
>> this one.
>
> Hi Sebastian,
> Does this patch work for you?
> May I have your Acked-and-Tested-by if you think this patch is ok.

Axel,

pinctrl for Dove will not be enabled before DT clock support for Dove,
which will hopefully make it into 3.8. If you agree, I will test and push it
with the related patches for enabling pinctrl.

Sebastian

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear
  2012-11-16 18:32     ` Sebastian Hesselbarth
@ 2012-11-17  1:22       ` Axel Lin
  0 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2012-11-17  1:22 UTC (permalink / raw)
  To: linux-arm-kernel

> pinctrl for Dove will not be enabled before DT clock support for Dove,
> which will hopefully make it into 3.8. If you agree, I will test and push it
> with the related patches for enabling pinctrl.
Ok. Thanks.

Axel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-17  1:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-11 13:44 [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear Axel Lin
2012-11-11 13:46 ` [PATCH RFT 2/2] pinctrl: dove: Checking valid config in dove_audio1_ctrl_set Axel Lin
2012-11-12  9:43   ` Sebastian Hesselbarth
2012-11-12  9:39 ` [PATCH RFT 1/2] pinctrl: dove: Fix dove_audio1_ctrl_set when BIT(0|1|2|3) of config is clear Sebastian Hesselbarth
2012-11-16  9:12   ` Axel Lin
2012-11-16 18:32     ` Sebastian Hesselbarth
2012-11-17  1:22       ` Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).