[PATCH v2] ASoC: davinci-mcasp: Get rid of bclk_lrclk_ratio in private data

2015-09-17 Thread Jyri Sarha
The slot_width is for essentially same thing. Instead of storing
bclk_lrclk_ratio, just store the slot_width. Comments has been updated
accordingly and some variable names changed to more descriptive.

Signed-off-by: Jyri Sarha 
---
Added the missing __func__ to dev_warn() warn call in
__davinci_mcasp_set_clkdiv().

 sound/soc/davinci/davinci-mcasp.c | 56 ++-
 1 file changed, 31 insertions(+), 25 deletions(-)

diff --git a/sound/soc/davinci/davinci-mcasp.c 
b/sound/soc/davinci/davinci-mcasp.c
index de1e3a8..9a9d633 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -87,7 +87,6 @@ struct davinci_mcasp {
u8  *serial_dir;
u8  version;
u8  bclk_div;
-   u16 bclk_lrclk_ratio;
int streams;
u32 irq_request[2];
int dma_request[2];
@@ -558,8 +557,21 @@ static int __davinci_mcasp_set_clkdiv(struct snd_soc_dai 
*dai, int div_id,
mcasp->bclk_div = div;
break;
 
-   case 2: /* BCLK/LRCLK ratio */
-   mcasp->bclk_lrclk_ratio = div;
+   case 2: /*
+* BCLK/LRCLK ratio descries how many bit-clock cycles
+* fit into one frame. The clock ratio is given for a
+* full period of data (for I2S format both left and
+* right channels), so it has to be divided by number
+* of tdm-slots (for I2S - divided by 2).
+* Instead of storing this ratio, we calculate a new
+* tdm_slot width by dividing the the ratio by the
+* number of configured tdm slots.
+*/
+   mcasp->slot_width = div / mcasp->tdm_slots;
+   if (div % mcasp->tdm_slots)
+   dev_warn(mcasp->dev,
+"%s(): BCLK/LRCLK %d is not divisible by %d 
tdm slots",
+__func__, div, mcasp->tdm_slots);
break;
 
default:
@@ -682,11 +694,13 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai 
*dai,
 }
 
 static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
-  int word_length)
+  int sample_width)
 {
u32 fmt;
-   u32 tx_rotate = (word_length / 4) & 0x7;
-   u32 mask = (1ULL << word_length) - 1;
+   u32 tx_rotate = (sample_width / 4) & 0x7;
+   u32 mask = (1ULL << sample_width) - 1;
+   u32 slot_width = sample_width;
+
/*
 * For captured data we should not rotate, inversion and masking is
 * enoguh to get the data to the right position:
@@ -699,31 +713,23 @@ static int davinci_config_channel_size(struct 
davinci_mcasp *mcasp,
u32 rx_rotate = 0;
 
/*
-* if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv()
-* callback, take it into account here. That allows us to for example
-* send 32 bits per channel to the codec, while only 16 of them carry
-* audio payload.
-* The clock ratio is given for a full period of data (for I2S format
-* both left and right channels), so it has to be divided by number of
-* tdm-slots (for I2S - divided by 2).
+* Setting the tdm slot width either with set_clkdiv() or
+* set_tdm_slot() allows us to for example send 32 bits per
+* channel to the codec, while only 16 of them carry audio
+* payload.
 */
-   if (mcasp->bclk_lrclk_ratio) {
-   u32 slot_length = mcasp->bclk_lrclk_ratio / mcasp->tdm_slots;
-
+   if (mcasp->slot_width) {
/*
-* When we have more bclk then it is needed for the data, we
-* need to use the rotation to move the received samples to have
-* correct alignment.
+* When we have more bclk then it is needed for the
+* data, we need to use the rotation to move the
+* received samples to have correct alignment.
 */
-   rx_rotate = (slot_length - word_length) / 4;
-   word_length = slot_length;
-   } else if (mcasp->slot_width) {
-   rx_rotate = (mcasp->slot_width - word_length) / 4;
-   word_length = mcasp->slot_width;
+   slot_width = mcasp->slot_width;
+   rx_rotate = (slot_width - sample_width) / 4;
}
 
/* mapping of the XSSZ bit-field as described in the datasheet */
-   fmt = (word_length >> 1) - 1;
+   fmt = (slot_width >> 1) - 1;
 
if (mcasp->op_mode != DAVINCI_MCASP_DIT_MODE) {
mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXSSZ(fmt),
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call

2015-09-17 Thread Jyri Sarha
Signed-off-by: Jyri Sarha 
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1929f0e..614b831 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3301,7 +3301,7 @@ static int snd_soc_of_get_slot_mask(struct device_node 
*np,
return 0;
val /= sizeof(u32);
for (i = 0; i < val; i++)
-   if (be32_to_cpup(_slot_mask[i]))
+   if (be32_to_cpup((__be32 *)_slot_mask[i]))
*mask |= (1 << i);
 
return val;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call

2015-09-17 Thread Jyri Sarha
Store return value of of_get_property() to a pointer of __be32 type as
device tree has big endian type. This fixes a sparse warning couple of
lines later when be32_to_cpup() is used to convert from big endian to
cpu endian.

The whole conversion is not really necessary, as we are only checking
if the value is zero or not, but I wanted to add it to remind in the
future that the data has to be converted before use. Compiler should
optimize the unnecessary operations away.

Signed-off-by: Jyri Sarha 
---
Damn, I wrote description ready but forgot to produce the patch again.
So here is a v3 of the same one liner patch.

 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1929f0e..af4999c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3294,7 +3294,7 @@ static int snd_soc_of_get_slot_mask(struct device_node 
*np,
unsigned int *mask)
 {
u32 val;
-   const u32 *of_slot_mask = of_get_property(np, prop_name, );
+   const __be32 *of_slot_mask = of_get_property(np, prop_name, );
int i;
 
if (!of_slot_mask)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call

2015-09-17 Thread Jyri Sarha

On 09/17/15 12:22, Mark Brown wrote:

On Thu, Sep 17, 2015 at 11:02:57AM +0300, Jyri Sarha wrote:


val /= sizeof(u32);
for (i = 0; i < val; i++)
-   if (be32_to_cpup(_slot_mask[i]))
+   if (be32_to_cpup((__be32 *)_slot_mask[i]))
*mask |= (1 << i);



There was no changelog and this is setting off alarm bells since the
cast just smashes warnings - are you sure we're not missing some other
annotations and that a cast is the best thing here?



You are right, I was a bit hasty. It is better to declare of_slot_mask 
to const __be32 * in the first place, instead of just const u32 * and 
then casting it to something else.


I'll send a new patch shortly.

BR,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call

2015-09-17 Thread Mark Brown
On Thu, Sep 17, 2015 at 11:02:57AM +0300, Jyri Sarha wrote:

>   val /= sizeof(u32);
>   for (i = 0; i < val; i++)
> - if (be32_to_cpup(_slot_mask[i]))
> + if (be32_to_cpup((__be32 *)_slot_mask[i]))
>   *mask |= (1 << i);
>  

There was no changelog and this is setting off alarm bells since the
cast just smashes warnings - are you sure we're not missing some other
annotations and that a cast is the best thing here?


signature.asc
Description: Digital signature


[PATCH v2] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call

2015-09-17 Thread Jyri Sarha
Signed-off-by: Jyri Sarha 
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1929f0e..af4999c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3294,7 +3294,7 @@ static int snd_soc_of_get_slot_mask(struct device_node 
*np,
unsigned int *mask)
 {
u32 val;
-   const u32 *of_slot_mask = of_get_property(np, prop_name, );
+   const __be32 *of_slot_mask = of_get_property(np, prop_name, );
int i;
 
if (!of_slot_mask)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: OMAP3: vc: Remove unused macros

2015-09-17 Thread Javier Martinez Canillas
The PRM_POLCTRL_TWL_MASK and PRM_POLCTRL_TWL_MASK
macros are not used so they can be deleted.

Signed-off-by: Javier Martinez Canillas 

---

 arch/arm/mach-omap2/vc.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index d44d311704ba..2028167fff31 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -280,10 +280,6 @@ void omap3_vc_set_pmic_signaling(int core_next_state)
}
 }
 
-#define PRM_POLCTRL_TWL_MASK   (OMAP3430_PRM_POLCTRL_CLKREQ_POL | \
-   OMAP3430_PRM_POLCTRL_CLKREQ_POL)
-#define PRM_POLCTRL_TWL_VALOMAP3430_PRM_POLCTRL_CLKREQ_POL
-
 /*
  * Configure signal polarity for sys_clkreq and sys_off_mode pins
  * as the default values are wrong and can cause the system to hang
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: OMAP: Remove duplicated operand in OR operation

2015-09-17 Thread Javier Martinez Canillas
Commit b483a4a5a711 ("ARM: OMAP4+: hwmod data: Don't prevent RESET of
USB Host module") added the SYSC_HAS_RESET_STATUS flag to both OMAP4
and OMAP5 USB host module hwmon sysconfig but that flag was already
set for OMAP5. So now the flag appears twice in the expression.

make coccicheck complains with the following message:

omap_hwmod_54xx_data.c:1846:37-58: duplicated argument to & or |

Signed-off-by: Javier Martinez Canillas 

---

 arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 7c3fac035e93..8cdfd9b7ab4f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -1844,8 +1844,7 @@ static struct omap_hwmod_class_sysconfig 
omap54xx_usb_host_hs_sysc = {
.rev_offs   = 0x,
.sysc_offs  = 0x0010,
.sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
-  SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
-  SYSC_HAS_RESET_STATUS),
+  SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
.idlemodes  = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
   SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
   MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: OMAP2+: Remove unneeded semicolons

2015-09-17 Thread Javier Martinez Canillas
Remove the unneded semicolons since they are clearly a typo error.

Signed-off-by: Javier Martinez Canillas 

---

 arch/arm/mach-omap2/pm44xx.c| 2 +-
 arch/arm/mach-omap2/powerdomains3xxx_data.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index d697cecf762b..178e22c146b7 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -210,7 +210,7 @@ static inline int omap4plus_init_static_deps(const struct 
static_dep_map *map)
}
 
map++;
-   };
+   }
 
return 0;
 }
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c 
b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index d31c495175c1..2e00c7f1f471 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -582,7 +582,7 @@ void __init omap3xxx_powerdomains_init(void)
 
/* Only 81xx needs custom pwrdm_operations */
if (!cpu_is_ti81xx())
-   pwrdm_register_platform_funcs(_pwrdm_operations);;
+   pwrdm_register_platform_funcs(_pwrdm_operations);
 
rev = omap_rev();
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] mmc: omap: Fix module autoload for OF platform driver

2015-09-17 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt 
---
 drivers/mmc/host/omap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index b763b11..b9958a1 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1490,6 +1490,7 @@ static const struct of_device_id mmc_omap_match[] = {
{ .compatible = "ti,omap2420-mmc", },
{ },
 };
+MODULE_DEVICE_TABLE(of, mmc_omap_match);
 #endif
 
 static struct platform_driver mmc_omap_driver = {
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: OMAP2+: PM: Denote the cpuidle tracepoints as _rcuidle()

2015-09-17 Thread Jisheng Zhang
The cpuidle tracepoints are called within a rcu_idle_exit() section, and
must be denoted with the _rcuidle() version of the tracepoint.

Signed-off-by: Jisheng Zhang 
---
 arch/arm/mach-omap2/pm34xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 87b98bf9..2dbd378 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -301,11 +301,11 @@ static void omap3_pm_idle(void)
if (omap_irq_pending())
return;
 
-   trace_cpu_idle(1, smp_processor_id());
+   trace_cpu_idle_rcuidle(1, smp_processor_id());
 
omap_sram_idle();
 
-   trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
+   trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id());
 }
 
 #ifdef CONFIG_SUSPEND
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html