Re: [PATCH V4 0/2] Add DT support for i2s

2012-12-07 Thread Padma Venkat
Hi,

On Fri, Dec 7, 2012 at 7:21 PM, Grant Likely  wrote:
> On Thu, 6 Dec 2012 13:11:42 +0900, Mark Brown 
>  wrote:
>> On Thu, Dec 06, 2012 at 09:31:40AM +0530, Padma Venkat wrote:
>> > On Wed, Nov 28, 2012 at 4:17 PM, Padmavathi Venna  
>> > wrote:
>>
>> > > Padmavathi Venna (2):
>> > >   ASoC: Samsung: Get I2S src_clk from clock alias id.
>> > >   ASoC: SAMSUNG: Add DT support for i2s
>>
>> > Any comments on DT support for i2s patch?  If not when this patch can be 
>> > pulled?
>>
>> Don't send contentless pings.
>>
>> I still don't really like what's going on with aliases here, I need to
>> understand why things are structured the way they are to say something
>> about that.
>
> Right. On a brief look, it appears that the binding is using aliases as
> a way to encode implementation specific details of the driver.

Samsung i2s driver registers the platform device twice one for the
samsung-i2s.0,1 or 2 and two for samsung-i2s.4(which actually doesn't
represent any H/W peripheral). The max number of I2S blocks on any
Samsung SoC are 3, the secondary device registration starts with
device number 4.The second time registration is for the secondary fifo
interface of a CPU dai if any exists.

With DT support the device number in the driver is always -1, I used
alias id for the above purpose.

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


[PATCH 03/25] ASoC: Samsung: remove __dev* attributes

2012-12-07 Thread Bill Pemberton
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton 
Cc: Ben Dooks 
Cc: Kukjin Kim 
Cc: Sangbeom Kim 
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org
---
 sound/soc/samsung/ac97.c   | 6 +++---
 sound/soc/samsung/bells.c  | 6 +++---
 sound/soc/samsung/dma.c| 4 ++--
 sound/soc/samsung/i2s.c| 9 -
 sound/soc/samsung/idma.c   | 6 +++---
 sound/soc/samsung/littlemill.c | 6 +++---
 sound/soc/samsung/lowland.c| 6 +++---
 sound/soc/samsung/pcm.c| 6 +++---
 sound/soc/samsung/s3c2412-i2s.c| 6 +++---
 sound/soc/samsung/s3c24xx-i2s.c| 6 +++---
 sound/soc/samsung/s3c24xx_simtec.c | 6 +++---
 sound/soc/samsung/s3c24xx_simtec_hermes.c  | 4 ++--
 sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c | 4 ++--
 sound/soc/samsung/smdk_wm8580pcm.c | 6 +++---
 sound/soc/samsung/smdk_wm8994.c| 6 +++---
 sound/soc/samsung/smdk_wm8994pcm.c | 6 +++---
 sound/soc/samsung/spdif.c  | 6 +++---
 sound/soc/samsung/speyside.c   | 6 +++---
 sound/soc/samsung/tobermory.c  | 6 +++---
 19 files changed, 55 insertions(+), 56 deletions(-)

diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index cd6c707..0df3c56 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -370,7 +370,7 @@ static struct snd_soc_dai_driver s3c_ac97_dai[] = {
},
 };
 
-static __devinit int s3c_ac97_probe(struct platform_device *pdev)
+static int s3c_ac97_probe(struct platform_device *pdev)
 {
struct resource *mem_res, *dmatx_res, *dmarx_res, *dmamic_res, *irq_res;
struct s3c_audio_pdata *ac97_pdata;
@@ -485,7 +485,7 @@ err1:
return ret;
 }
 
-static __devexit int s3c_ac97_remove(struct platform_device *pdev)
+static int s3c_ac97_remove(struct platform_device *pdev)
 {
struct resource *mem_res, *irq_res;
 
@@ -510,7 +510,7 @@ static __devexit int s3c_ac97_remove(struct platform_device 
*pdev)
 
 static struct platform_driver s3c_ac97_driver = {
.probe  = s3c_ac97_probe,
-   .remove = __devexit_p(s3c_ac97_remove),
+   .remove = s3c_ac97_remove,
.driver = {
.name = "samsung-ac97",
.owner = THIS_MODULE,
diff --git a/sound/soc/samsung/bells.c b/sound/soc/samsung/bells.c
index 01c1c5a..ceed466 100644
--- a/sound/soc/samsung/bells.c
+++ b/sound/soc/samsung/bells.c
@@ -412,7 +412,7 @@ static struct snd_soc_card bells_cards[] = {
 };
 
 
-static __devinit int bells_probe(struct platform_device *pdev)
+static int bells_probe(struct platform_device *pdev)
 {
int ret;
 
@@ -429,7 +429,7 @@ static __devinit int bells_probe(struct platform_device 
*pdev)
return 0;
 }
 
-static int __devexit bells_remove(struct platform_device *pdev)
+static int bells_remove(struct platform_device *pdev)
 {
snd_soc_unregister_card(&bells_cards[pdev->id]);
 
@@ -443,7 +443,7 @@ static struct platform_driver bells_driver = {
.pm = &snd_soc_pm_ops,
},
.probe = bells_probe,
-   .remove = __devexit_p(bells_remove),
+   .remove = bells_remove,
 };
 
 module_platform_driver(bells_driver);
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index 6452990..db87628 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -432,13 +432,13 @@ static struct snd_soc_platform_driver 
samsung_asoc_platform = {
.pcm_free   = dma_free_dma_buffers,
 };
 
-int __devinit asoc_dma_platform_register(struct device *dev)
+int asoc_dma_platform_register(struct device *dev)
 {
return snd_soc_register_platform(dev, &samsung_asoc_platform);
 }
 EXPORT_SYMBOL_GPL(asoc_dma_platform_register);
 
-void __devexit asoc_dma_platform_unregister(struct device *dev)
+void asoc_dma_platform_unregister(struct device *dev)
 {
snd_soc_unregister_platform(dev);
 }
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 0aa0451..d2d124f 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -952,8 +952,7 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = {
SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_S24_LE)
 
-static __devinit
-struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
+static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
 {
struct i2s_dai *i2s;
 
@@ -994,7 +993,7 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, 
bool sec)
return i2s;
 }
 
-static __devinit int samsung_i2s_probe(struct platform_device *pdev)
+static int sa

Re: [PATCH V4 0/2] Add DT support for i2s

2012-12-07 Thread Grant Likely
On Thu, 6 Dec 2012 13:11:42 +0900, Mark Brown 
 wrote:
> On Thu, Dec 06, 2012 at 09:31:40AM +0530, Padma Venkat wrote:
> > On Wed, Nov 28, 2012 at 4:17 PM, Padmavathi Venna  
> > wrote:
> 
> > > Padmavathi Venna (2):
> > >   ASoC: Samsung: Get I2S src_clk from clock alias id.
> > >   ASoC: SAMSUNG: Add DT support for i2s
> 
> > Any comments on DT support for i2s patch?  If not when this patch can be 
> > pulled?
> 
> Don't send contentless pings.
> 
> I still don't really like what's going on with aliases here, I need to
> understand why things are structured the way they are to say something
> about that.

Right. On a brief look, it appears that the binding is using aliases as
a way to encode implementation specific details of the driver.

g.

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


Re: [PATCH 3/3] ARM: EXYNOS5: save CLK_TOP_SRC3 register before powergating

2012-12-07 Thread Prasanna Kumar
Hi Thomas,

Thanks for the comments.Please find my reply inline.

On Tue, Dec 4, 2012 at 2:29 PM, Thomas Abraham
 wrote:
>
> On 27 November 2012 17:52, Prasanna Kumar  wrote:
> > From: Prasanna Kumar 
> >
> > This patch adds a software workaround to the hardware
> > problem found in exynos5 while powergating.
> >
> > It is observed that CLK_TOP_SRC3 register gets modified if
> > the G-Scaler/MFC devices are power gated. The clock for G-Scaler gets
> > set to XXTI which results in the device running very slow .
> > A big drop in performance is noticed whilerunning the video.
> > This issue also occurs while powergating MFC.
> >
> > The value of clock source register is restored once the powergating
> > operation is completed.
> >
> > Signed-off-by: Prasanna Kumar 
> > ---
> >  arch/arm/mach-exynos/pm_domains.c |   27 +++
> >  1 files changed, 27 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-exynos/pm_domains.c
> > b/arch/arm/mach-exynos/pm_domains.c
> > index 9f1351d..955cbe3 100644
> > --- a/arch/arm/mach-exynos/pm_domains.c
> > +++ b/arch/arm/mach-exynos/pm_domains.c
> > @@ -48,6 +51,23 @@ static int exynos_pd_power(struct generic_pm_domain
> > *domain, bool power_on)
> > pwr = power_on ? S5P_INT_LOCAL_PWR_EN : 0;
> > __raw_writel(pwr, base);
> >
> > +   /*
> > +*It is found that the CLK SRC register in exynos5
> > +*gets modified when power domain of gsc/mfc/isp/disp1
> > +*is powered off.This happens only after the system is
> > +*suspended and resumed and not before that.
> > +*The following fix adresses this hardware issue.
> > +*It saves the value of clock source register and
> > +*resores it later
> > +*/
> > +
> > +   if (soc_is_exynos5250()) {
> > +   if (!power_on) {
> > +   /* save clock source register */
> > +   tmp = __raw_readl(EXYNOS5_CLKSRC_TOP3);
> > +   }
> > +   }
>
> Does the value of EXYNOS5_CLKSRC_TOP3 register change as soon as the
> G-Scaler/MFC devices are power gated?
>
> - If yes, the value of CLKSRC register should be saved before the
> power domain register is programmed.
>
> - If not, as mentioned in the comment, if this issue occurs during a
> suspend-resume cycle, the value of this register can be saved and
> restored in the clock driver code itself.
>
During a normal power gating sequence, this problem is not seen
But Once the suspend-resume cycle is done,  if we try to turn on or
turn off domain,
this issue occurs.

I agree that CLKSRC register should be saved
before the power domain register is programmed.

Saving of CLKSRC_TOP3 register is already being done in clock driver
code.i.e in exynos5_clock_save[]. But the problem remains. So i feel
an exclusive saving of the register in pm_domain driver is required.

Kindly let me know your opinion

> The other thing that needs to be relooked into here is the use of
> EXYNOS5_CLKSRC_TOP3 register address. Currently, the clock registers
> are statically io-remapped. With the upcoming migration to common
> clock for Exynos5, the clock registers will not be statically
> io-remapped but instead remapped during clock initialization. So the
> use of EXYNOS5_CLKSRC_TOP3 will not hold and so we need to relook into
> this.

Yes , we can look into this, once the clock migration happens for Exynos5
Until then, can it be used as statically io-remapped ?


> > @@ -61,6 +81,13 @@ static int exynos_pd_power(struct generic_pm_domain
> > *domain, bool power_on)
> > cpu_relax();
> > usleep_range(80, 100);
> > }
> > +
> > +   if (soc_is_exynos5250()) {
>
> We could use the of_machine_is_compatible api here instead of
> soc_is_exynos5250() macro.
>

Yes, of_machine_is_compatible function will be used
instead of soc_is_exynos5250()


> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel




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


Re: [PATCH] I2C: EXYNOS: Add slave support to i2c

2012-12-07 Thread Russell King - ARM Linux
On Fri, Dec 07, 2012 at 05:33:17PM +0530, Tushar Behera wrote:
> On 12/03/2012 05:46 PM, Giridhar Maruthy wrote:
> > This patch adds slave support to i2c. The dt entry i2c-mode
> > decides at probe time if the controller needs to work in
> > slave mode and the controller is accordingly programmed.

(I don't have the original patches.)

Hmm.  How has slave-mode support been tested?

Remembering that I2C slave devices do not initiate bus accesses, all
accesses will be started by some other master.  How are you dealing
with the bytes received from the master, and how are you returning a
response to the master in reply to a read request?

We had support for this on PXA I2C through a callback from the driver
into PXA code (used for the Psion Teklogix Netbook device) and it worked
really well, but what you can't do is use the standard I2C interfaces
for slave mode.
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] I2C: EXYNOS: Add slave support to i2c

2012-12-07 Thread Tushar Behera
On 12/03/2012 05:46 PM, Giridhar Maruthy wrote:
> This patch adds slave support to i2c. The dt entry i2c-mode
> decides at probe time if the controller needs to work in
> slave mode and the controller is accordingly programmed.
> 
> Signed-off-by: Giridhar Maruthy 
> ---
>  drivers/i2c/busses/i2c-s3c2410.c |  100
> ++
>  1 file changed, 68 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c
> b/drivers/i2c/busses/i2c-s3c2410.c
> index e93e7d6..d83a6d7 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -53,6 +53,9 @@
>  /* Max time to wait for bus to become idle after a xfer (in us) */
>  #define S3C2410_IDLE_TIMEOUT   5000
> 
> +/* To find the master/slave mode of current controller */
> +#define is_master(i2c) (!i2c->i2c_mode)
> +
>  /* i2c controller state */
>  enum s3c24xx_i2c_state {
> STATE_IDLE,
> @@ -89,6 +92,8 @@ struct s3c24xx_i2c {
>  #ifdef CONFIG_CPU_FREQ
> struct notifier_block   freq_transition;
>  #endif
> +   /* i2c_mode: 0 is for master; and 1 is for slave */
> +   unsigned inti2c_mode;
>  };
> 
>  static struct platform_device_id s3c24xx_driver_ids[] = {
> @@ -202,11 +207,21 @@ static void s3c24xx_i2c_message_start(struct
> s3c24xx_i2c *i2c,
> stat = 0;
> stat |=  S3C2410_IICSTAT_TXRXEN;
> 
> -   if (msg->flags & I2C_M_RD) {
> -   stat |= S3C2410_IICSTAT_MASTER_RX;
> -   addr |= 1;
> -   } else
> -   stat |= S3C2410_IICSTAT_MASTER_TX;
> +   if (is_master(i2c)) {
> +   /* Master mode */
> +   if (msg->flags & I2C_M_RD) {
> +   stat |= S3C2410_IICSTAT_MASTER_RX;
> +   addr |= 1;
> +   } else
> +   stat |= S3C2410_IICSTAT_MASTER_TX;
> +   } else {
> +   /* Slave mode */
> +   if (msg->flags & I2C_M_RD) {
> +   stat |= S3C2410_IICSTAT_SLAVE_RX;
> +   addr |= 1;
> +   } else
> +   stat |= S3C2410_IICSTAT_SLAVE_TX;
> +   }
> 
> if (msg->flags & I2C_M_REV_DIR_ADDR)
> addr ^= 1;
> @@ -228,8 +243,10 @@ static void s3c24xx_i2c_message_start(struct
> s3c24xx_i2c *i2c,
> dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon);
> writel(iiccon, i2c->regs + S3C2410_IICCON);
> 
> -   stat |= S3C2410_IICSTAT_START;
> -   writel(stat, i2c->regs + S3C2410_IICSTAT);
> +   if (is_master(i2c)) {
> +   stat |= S3C2410_IICSTAT_START;
> +   writel(stat, i2c->regs + S3C2410_IICSTAT);
> +   }
>  }
> 
>  static inline void s3c24xx_i2c_stop(struct s3c24xx_i2c *i2c, int ret)
> @@ -272,14 +289,19 @@ static inline void s3c24xx_i2c_stop(struct
> s3c24xx_i2c *i2c, int ret)
>  * devices, the host as Master and the HDMIPHY device as the slave.
>  * Skipping the STOP condition has been tested on this bus and
> works.
>  */
> -   if (i2c->quirks & QUIRK_HDMIPHY) {
> -   /* Stop driving the I2C pins */
> -   iicstat &= ~S3C2410_IICSTAT_TXRXEN;
> -   } else {
> -   /* stop the transfer */
> -   iicstat &= ~S3C2410_IICSTAT_START;
> +   if (is_master(i2c)) {
> +   if (i2c->quirks & QUIRK_HDMIPHY) {
> +   /* Stop driving the I2C pins */
> +   iicstat &= ~S3C2410_IICSTAT_TXRXEN;
> +   } else {
> +   /* stop the transfer */
> +   if (is_master(i2c)) {

This is executed only if is_master(i2c) is true, so there seems no need
to checking it again.

> +   /* Start/Stop required only for master */
> +   iicstat &= ~S3C2410_IICSTAT_START;
> +   }
> +   }
> +   writel(iicstat, i2c->regs + S3C2410_IICSTAT);
> }
> -   writel(iicstat, i2c->regs + S3C2410_IICSTAT);
> 
> i2c->state = STATE_STOP;
> 
> @@ -348,7 +370,8 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c
> *i2c, unsigned long iicstat)
>  */
> 
> if (iicstat & S3C2410_IICSTAT_LASTBIT &&
> -   !(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
> +   !(i2c->msg->flags & I2C_M_IGNORE_NAK) &&
> +   is_master(i2c)) {
> /* ack was not received... */
> 
> dev_dbg(i2c->dev, "ack was not received\n");
> @@ -380,7 +403,7 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c
> *i2c, unsigned long iicstat)
>  * end of the message, and if so, work out what to do
>  */
> 
> -   if (!(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
> +   if (!(i2c->msg->flags & I2C_M_IGNORE_NAK) &&
> is_master(i2c)) {
> if (iicstat & S3C2410_IICSTAT_LAS

Re: [PATCH] I2C: EXYNOS: Add slave support to i2c

2012-12-07 Thread Giridhar Maruthy
Thanks for the review Subash. Please find my reply below.

On 6 December 2012 23:05, Subash Patel  wrote:
> Hi Giridhar,
>
>
> On 12/03/2012 05:46 PM, Giridhar Maruthy wrote:
>>
>> This patch adds slave support to i2c. The dt entry i2c-mode
>> decides at probe time if the controller needs to work in
>> slave mode and the controller is accordingly programmed.
>>
>> Signed-off-by: Giridhar Maruthy > >
>>
>> ---
>>   drivers/i2c/busses/i2c-s3c2410.c |  100
>> ++
>>   1 file changed, 68 insertions(+), 32 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-s3c2410.c
>> b/drivers/i2c/busses/i2c-s3c2410.c
>> index e93e7d6..d83a6d7 100644
>> --- a/drivers/i2c/busses/i2c-s3c2410.c
>> +++ b/drivers/i2c/busses/i2c-s3c2410.c
>> @@ -53,6 +53,9 @@
>>   /* Max time to wait for bus to become idle after a xfer (in us) */
>>   #define S3C2410_IDLE_TIMEOUT   5000
>>
>> +/* To find the master/slave mode of current controller */
>> +#define is_master(i2c) (!i2c->i2c_mode)
>> +
>>   /* i2c controller state */
>>   enum s3c24xx_i2c_state {
>>  STATE_IDLE,
>> @@ -89,6 +92,8 @@ struct s3c24xx_i2c {
>>   #ifdef CONFIG_CPU_FREQ
>>  struct notifier_block   freq_transition;
>>   #endif
>> +   /* i2c_mode: 0 is for master; and 1 is for slave */
>> +   unsigned inti2c_mode;
>>   };
>>
>>   static struct platform_device_id s3c24xx_driver_ids[] = {
>> @@ -202,11 +207,21 @@ static void s3c24xx_i2c_message_start(struct
>> s3c24xx_i2c *i2c,
>>  stat = 0;
>>  stat |=  S3C2410_IICSTAT_TXRXEN;
>>
>> -   if (msg->flags & I2C_M_RD) {
>> -   stat |= S3C2410_IICSTAT_MASTER_RX;
>> -   addr |= 1;
>> -   } else
>> -   stat |= S3C2410_IICSTAT_MASTER_TX;
>> +   if (is_master(i2c)) {
>> +   /* Master mode */
>> +   if (msg->flags & I2C_M_RD) {
>> +   stat |= S3C2410_IICSTAT_MASTER_RX;
>> +   addr |= 1;
>> +   } else
>> +   stat |= S3C2410_IICSTAT_MASTER_TX;
>> +   } else {
>> +   /* Slave mode */
>> +   if (msg->flags & I2C_M_RD) {
>> +   stat |= S3C2410_IICSTAT_SLAVE_RX;
>> +   addr |= 1;
>> +   } else
>> +   stat |= S3C2410_IICSTAT_SLAVE_TX;
>> +   }
>>
>>  if (msg->flags & I2C_M_REV_DIR_ADDR)
>>  addr ^= 1;
>> @@ -228,8 +243,10 @@ static void s3c24xx_i2c_message_start(struct
>> s3c24xx_i2c *i2c,
>>  dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon);
>>  writel(iiccon, i2c->regs + S3C2410_IICCON);
>>
>> -   stat |= S3C2410_IICSTAT_START;
>> -   writel(stat, i2c->regs + S3C2410_IICSTAT);
>> +   if (is_master(i2c)) {
>> +   stat |= S3C2410_IICSTAT_START;
>> +   writel(stat, i2c->regs + S3C2410_IICSTAT);
>> +   }
>>   }
>>
>>   static inline void s3c24xx_i2c_stop(struct s3c24xx_i2c *i2c, int ret)
>> @@ -272,14 +289,19 @@ static inline void s3c24xx_i2c_stop(struct
>> s3c24xx_i2c *i2c, int ret)
>>   * devices, the host as Master and the HDMIPHY device as the
>> slave.
>>   * Skipping the STOP condition has been tested on this bus and
>> works.
>>   */
>> -   if (i2c->quirks & QUIRK_HDMIPHY) {
>> -   /* Stop driving the I2C pins */
>> -   iicstat &= ~S3C2410_IICSTAT_TXRXEN;
>> -   } else {
>> -   /* stop the transfer */
>> -   iicstat &= ~S3C2410_IICSTAT_START;
>> +   if (is_master(i2c)) {
>> +   if (i2c->quirks & QUIRK_HDMIPHY) {
>> +   /* Stop driving the I2C pins */
>> +   iicstat &= ~S3C2410_IICSTAT_TXRXEN;
>> +   } else {
>> +   /* stop the transfer */
>> +   if (is_master(i2c)) {
>> +   /* Start/Stop required only for master */
>> +   iicstat &= ~S3C2410_IICSTAT_START;
>> +   }
>> +   }
>> +   writel(iicstat, i2c->regs + S3C2410_IICSTAT);
>
>
> I don't see i2c controller for HDMIPHY working in slave mode. So do we need
> to check if its master and proceed? Cant the quirks check enough for it?
> Even if it is configured as slave, there is no error indication for this
> here.

My understanding is that the HDMIPHY always commands and hence,
HDMIPHY does not need to be slave at all.
But if you think it is a policy decision which need not be implemented
in driver, I agree with you.
>
>>  }
>> -   writel(iicstat, i2c->regs + S3C2410_IICSTAT);
>>
>>  i2c->state = STATE_STOP;
>>
>> @@ -348,7 +370,8 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c
>> *i2c, unsigned long iicstat)
>>   */
>>
>>  if (iicstat & S3C2410_IICSTAT_LASTBIT &&
>> -   !(i2c->msg->flags & I2C_M

Re: [PATCH RESEND V2 1/2] ASoC: Samsung: Do not register samsung audio dma device as pdev

2012-12-07 Thread Mark Brown
On Fri, Dec 07, 2012 at 01:59:21PM +0530, Padmavathi Venna wrote:
> Previously, the ASoC 'platform' (PCM/DMA) object was instantiated via a
> platform_device. This didn't represent the hardware well, since there
> was no separate hardware associated with this platform_device; it was a
> virtual device with sole purpose to call snd_soc_register_platform().

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


[PATCH RESEND V2 2/2] ASoC: SMDK: WM8994: Add device tree support for machine file

2012-12-07 Thread Padmavathi Venna
Add the basic device tree based lookup.

Signed-off-by: Padmavathi Venna 
---
 .../bindings/sound/samsung,smdk-wm8994.txt |   14 ++
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |   12 +
 sound/soc/samsung/smdk_wm8994.c|   26 
 3 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/samsung,smdk-wm8994.txt

diff --git a/Documentation/devicetree/bindings/sound/samsung,smdk-wm8994.txt 
b/Documentation/devicetree/bindings/sound/samsung,smdk-wm8994.txt
new file mode 100644
index 000..13cb189
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/samsung,smdk-wm8994.txt
@@ -0,0 +1,14 @@
+Samsung SMDK audio complex
+
+Required properties:
+- compatible : "samsung,smdk-wm8994"
+- samsung,i2s-controller: The phandle of the Samsung I2S0 controller
+- samsung,audio-codec: The phandle of the WM8994 audio codec
+Example:
+
+sound {
+   compatible = "samsung,smdk-wm8994";
+
+   samsung,i2s-controller = <&i2s_0>;
+   samsung,audio-codec = <&wm8994>;
+};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts 
b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index a352df4..5cbb08d 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -53,6 +53,11 @@
compatible = "samsung,s524ad0xd1";
reg = <0x51>;
};
+
+   wm8994: wm8994@1a {
+compatible = "wlf,wm8994";
+reg = <0x1a>;
+   };
};
 
i2c@12C8 {
@@ -166,4 +171,11 @@
spi_2: spi@12d4 {
status = "disabled";
};
+
+   sound {
+   compatible = "samsung,smdk-wm8994";
+
+   samsung,i2s-controller = <&i2s_0>;
+   samsung,audio-codec = <&wm8994>;
+   };
 };
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c
index dd0aa8c..2f3e2b8 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -10,6 +10,7 @@
 #include "../codecs/wm8994.h"
 #include 
 #include 
+#include 
 
  /*
   * Default CFG switch settings to use this driver:
@@ -153,9 +154,25 @@ static struct snd_soc_card smdk = {
 static int __devinit smdk_audio_probe(struct platform_device *pdev)
 {
int ret;
+   struct device_node *np = pdev->dev.of_node;
struct snd_soc_card *card = &smdk;
 
card->dev = &pdev->dev;
+
+   if (np) {
+   smdk_dai[0].cpu_dai_name = NULL;
+   smdk_dai[0].cpu_of_node = of_parse_phandle(np,
+   "samsung,i2s-controller", 0);
+   if (!smdk_dai[0].cpu_of_node) {
+   dev_err(&pdev->dev,
+  "Property 'samsung,i2s-controller' missing or 
invalid\n");
+   ret = -EINVAL;
+   }
+
+   smdk_dai[0].platform_name = NULL;
+   smdk_dai[0].platform_of_node = smdk_dai[0].cpu_of_node;
+   }
+
ret = snd_soc_register_card(card);
 
if (ret)
@@ -173,10 +190,19 @@ static int __devexit smdk_audio_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id samsung_wm8994_of_match[] = {
+   { .compatible = "samsung,smdk-wm8994", },
+   {},
+};
+MODULE_DEVICE_TABLE(of, samsung_wm8994_of_match);
+#endif /* CONFIG_OF */
+
 static struct platform_driver smdk_audio_driver = {
.driver = {
.name   = "smdk-audio",
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(samsung_wm8994_of_match),
},
.probe  = smdk_audio_probe,
.remove = __devexit_p(smdk_audio_remove),
-- 
1.7.4.4

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


[PATCH RESEND V2 1/2] ASoC: Samsung: Do not register samsung audio dma device as pdev

2012-12-07 Thread Padmavathi Venna
Previously, the ASoC 'platform' (PCM/DMA) object was instantiated via a
platform_device. This didn't represent the hardware well, since there
was no separate hardware associated with this platform_device; it was a
virtual device with sole purpose to call snd_soc_register_platform().

This change removes the platform_device completely. Each Samsung DAI now
registers the ASoC 'platform' itself. Machine drivers are adjusted for
the new 'platform' name.

Signed-off-by: Padmavathi Venna 
---
 arch/arm/mach-exynos/mach-armlex4210.c |1 -
 arch/arm/mach-exynos/mach-smdkv310.c   |1 -
 arch/arm/mach-s3c24xx/mach-gta02.c |1 -
 arch/arm/mach-s3c24xx/mach-h1940.c |1 -
 arch/arm/mach-s3c24xx/mach-mini2440.c  |1 -
 arch/arm/mach-s3c24xx/mach-rx1950.c|1 -
 arch/arm/mach-s3c64xx/mach-crag6410.c  |1 -
 arch/arm/mach-s3c64xx/mach-smdk6410.c  |1 -
 arch/arm/mach-s5p64x0/mach-smdk6440.c  |1 -
 arch/arm/mach-s5p64x0/mach-smdk6450.c  |1 -
 arch/arm/mach-s5pc100/mach-smdkc100.c  |1 -
 arch/arm/mach-s5pv210/mach-smdkc110.c  |1 -
 arch/arm/mach-s5pv210/mach-smdkv210.c  |1 -
 arch/arm/plat-samsung/devs.c   |9 -
 arch/arm/plat-samsung/include/plat/devs.h  |1 -
 sound/soc/samsung/ac97.c   |   10 +-
 sound/soc/samsung/bells.c  |6 +++---
 sound/soc/samsung/dma.c|   24 ++--
 sound/soc/samsung/dma.h|3 +++
 sound/soc/samsung/goni_wm8994.c|2 +-
 sound/soc/samsung/h1940_uda1380.c  |2 +-
 sound/soc/samsung/i2s.c|4 
 sound/soc/samsung/jive_wm8750.c|2 +-
 sound/soc/samsung/littlemill.c |2 +-
 sound/soc/samsung/ln2440sbc_alc650.c   |2 +-
 sound/soc/samsung/lowland.c|2 +-
 sound/soc/samsung/neo1973_wm8753.c |2 +-
 sound/soc/samsung/pcm.c|9 +
 sound/soc/samsung/rx1950_uda1380.c |2 +-
 sound/soc/samsung/s3c2412-i2s.c|   20 +++-
 sound/soc/samsung/s3c24xx-i2s.c|   20 +++-
 sound/soc/samsung/s3c24xx_simtec_hermes.c  |2 +-
 sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c |2 +-
 sound/soc/samsung/s3c24xx_uda134x.c|2 +-
 sound/soc/samsung/smartq_wm8987.c  |2 +-
 sound/soc/samsung/smdk2443_wm9710.c|2 +-
 sound/soc/samsung/smdk_spdif.c |2 +-
 sound/soc/samsung/smdk_wm8580.c|6 +++---
 sound/soc/samsung/smdk_wm8580pcm.c |2 +-
 sound/soc/samsung/smdk_wm8994.c|4 ++--
 sound/soc/samsung/smdk_wm8994pcm.c |2 +-
 sound/soc/samsung/smdk_wm9713.c|2 +-
 sound/soc/samsung/spdif.c  |   10 +-
 sound/soc/samsung/speyside.c   |2 +-
 sound/soc/samsung/tobermory.c  |2 +-
 45 files changed, 105 insertions(+), 72 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-armlex4210.c 
b/arch/arm/mach-exynos/mach-armlex4210.c
index 3f37a5e..b938f9f 100644
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ b/arch/arm/mach-exynos/mach-armlex4210.c
@@ -147,7 +147,6 @@ static struct platform_device *armlex4210_devices[] 
__initdata = {
&s3c_device_hsmmc3,
&s3c_device_rtc,
&s3c_device_wdt,
-   &samsung_asoc_dma,
&armlex4210_smsc911x,
&exynos4_device_ahci,
 };
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c 
b/arch/arm/mach-exynos/mach-smdkv310.c
index ee4fb1a..5de9ee2 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -311,7 +311,6 @@ static struct platform_device *smdkv310_devices[] 
__initdata = {
&s5p_device_mfc_l,
&s5p_device_mfc_r,
&exynos4_device_spdif,
-   &samsung_asoc_dma,
&samsung_asoc_idma,
&s5p_device_fimd0,
&smdkv310_device_audio,
diff --git a/arch/arm/mach-s3c24xx/mach-gta02.c 
b/arch/arm/mach-s3c24xx/mach-gta02.c
index 4a96346..973b87c 100644
--- a/arch/arm/mach-s3c24xx/mach-gta02.c
+++ b/arch/arm/mach-s3c24xx/mach-gta02.c
@@ -521,7 +521,6 @@ static struct platform_device *gta02_devices[] __initdata = 
{
>a02_nor_flash,
&s3c24xx_pwm_device,
&s3c_device_iis,
-   &samsung_asoc_dma,
&s3c_device_i2c0,
>a02_dfbmcs320_device,
>a02_buttons_device,
diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c 
b/arch/arm/mach-s3c24xx/mach-h1940.c
index 63aaf07..b23dd1b 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -632,7 +632,6 @@ static struct platform_device *h1940_devices[] __initdata = 
{
&s3c_device_wdt,
&s3c_de

[PATCH RESEND V2 0/2] ASoC: Samsung: Remove platform device support

2012-12-07 Thread Padmavathi Venna
Changes since V1:
- Renamed all samsung based audio platform names with the corresponding
  cpu dai name
- Register the dma device in the corresponding samsung cpu dai driver
- Deleted "samsung_asoc_dma" platform device from devs.c
- Deleted the "samsung_asoc_dma" platfrom device entry from the list of
  registered platform devices in the legacy platforms.
- Renamed the function name from samsung_dma_platform_register to
  asoc_dma_platform_register
- Added binding documentation for new device tree binding

Padmavathi Venna (2):
  ASoC: Samsung: Do not register samsung audio dma device as pdev
  ASoC: SMDK: WM8994: Add device tree support for machine file

 .../bindings/sound/samsung,smdk-wm8994.txt |   14 +
 arch/arm/boot/dts/exynos5250-smdk5250.dts  |   12 
 arch/arm/mach-exynos/mach-armlex4210.c |1 -
 arch/arm/mach-exynos/mach-smdkv310.c   |1 -
 arch/arm/mach-s3c24xx/mach-gta02.c |1 -
 arch/arm/mach-s3c24xx/mach-h1940.c |1 -
 arch/arm/mach-s3c24xx/mach-mini2440.c  |1 -
 arch/arm/mach-s3c24xx/mach-rx1950.c|1 -
 arch/arm/mach-s3c64xx/mach-crag6410.c  |1 -
 arch/arm/mach-s3c64xx/mach-smdk6410.c  |1 -
 arch/arm/mach-s5p64x0/mach-smdk6440.c  |1 -
 arch/arm/mach-s5p64x0/mach-smdk6450.c  |1 -
 arch/arm/mach-s5pc100/mach-smdkc100.c  |1 -
 arch/arm/mach-s5pv210/mach-smdkc110.c  |1 -
 arch/arm/mach-s5pv210/mach-smdkv210.c  |1 -
 arch/arm/plat-samsung/devs.c   |9 --
 arch/arm/plat-samsung/include/plat/devs.h  |1 -
 sound/soc/samsung/ac97.c   |   10 ++-
 sound/soc/samsung/bells.c  |6 ++--
 sound/soc/samsung/dma.c|   24 
 sound/soc/samsung/dma.h|3 ++
 sound/soc/samsung/goni_wm8994.c|2 +-
 sound/soc/samsung/h1940_uda1380.c  |2 +-
 sound/soc/samsung/i2s.c|4 ++
 sound/soc/samsung/jive_wm8750.c|2 +-
 sound/soc/samsung/littlemill.c |2 +-
 sound/soc/samsung/ln2440sbc_alc650.c   |2 +-
 sound/soc/samsung/lowland.c|2 +-
 sound/soc/samsung/neo1973_wm8753.c |2 +-
 sound/soc/samsung/pcm.c|9 ++
 sound/soc/samsung/rx1950_uda1380.c |2 +-
 sound/soc/samsung/s3c2412-i2s.c|   20 -
 sound/soc/samsung/s3c24xx-i2s.c|   20 -
 sound/soc/samsung/s3c24xx_simtec_hermes.c  |2 +-
 sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c |2 +-
 sound/soc/samsung/s3c24xx_uda134x.c|2 +-
 sound/soc/samsung/smartq_wm8987.c  |2 +-
 sound/soc/samsung/smdk2443_wm9710.c|2 +-
 sound/soc/samsung/smdk_spdif.c |2 +-
 sound/soc/samsung/smdk_wm8580.c|6 ++--
 sound/soc/samsung/smdk_wm8580pcm.c |2 +-
 sound/soc/samsung/smdk_wm8994.c|   30 ++-
 sound/soc/samsung/smdk_wm8994pcm.c |2 +-
 sound/soc/samsung/smdk_wm9713.c|2 +-
 sound/soc/samsung/spdif.c  |   10 ++-
 sound/soc/samsung/speyside.c   |2 +-
 sound/soc/samsung/tobermory.c  |2 +-
 47 files changed, 157 insertions(+), 72 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/sound/samsung,smdk-wm8994.txt

-- 
1.7.4.4

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


[PATCH 5/5] cpufreq: exynos: Add missing static

2012-12-07 Thread Jonghwan Choi
Add missing 'static' qualifiers.

Signed-off-by: Jonghwan Choi 
---
 drivers/cpufreq/exynos-cpufreq.c |4 ++--
 drivers/cpufreq/exynos4210-cpufreq.c |2 +-
 drivers/cpufreq/exynos4x12-cpufreq.c |2 +-
 drivers/cpufreq/exynos5250-cpufreq.c |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/exynos-cpufreq.c
b/drivers/cpufreq/exynos-cpufreq.c
index b0338e1..1bd3e3a 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -31,13 +31,13 @@ static unsigned int locking_frequency;
 static bool frequency_locked;
 static DEFINE_MUTEX(cpufreq_lock);

-int exynos_verify_speed(struct cpufreq_policy *policy)
+static int exynos_verify_speed(struct cpufreq_policy *policy)
 {
return cpufreq_frequency_table_verify(policy,
  exynos_info->freq_table);
 }

-unsigned int exynos_getspeed(unsigned int cpu)
+static unsigned int exynos_getspeed(unsigned int cpu)
 {
return clk_get_rate(exynos_info->cpu_clk) / 1000;
 }
diff --git a/drivers/cpufreq/exynos4210-cpufreq.c
b/drivers/cpufreq/exynos4210-cpufreq.c
index 250dcf0..de91755 100644
--- a/drivers/cpufreq/exynos4210-cpufreq.c
+++ b/drivers/cpufreq/exynos4210-cpufreq.c
@@ -114,7 +114,7 @@ static void exynos4210_set_apll(unsigned int index)
} while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT));
 }

-bool exynos4210_pms_change(unsigned int old_index, unsigned int new_index)
+static bool exynos4210_pms_change(unsigned int old_index, unsigned int
new_index)
 {
unsigned int old_pm = apll_freq_4210[old_index].mps >> 8;
unsigned int new_pm = apll_freq_4210[new_index].mps >> 8;
diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c
b/drivers/cpufreq/exynos4x12-cpufreq.c
index 224445d..0661039 100644
--- a/drivers/cpufreq/exynos4x12-cpufreq.c
+++ b/drivers/cpufreq/exynos4x12-cpufreq.c
@@ -166,7 +166,7 @@ static void exynos4x12_set_apll(unsigned int index)
} while (tmp != (0x1 << EXYNOS4_CLKSRC_CPU_MUXCORE_SHIFT));
 }

-bool exynos4x12_pms_change(unsigned int old_index, unsigned int new_index)
+static bool exynos4x12_pms_change(unsigned int old_index, unsigned int
new_index)
 {
unsigned int old_pm = apll_freq_4x12[old_index].mps >> 8;
unsigned int new_pm = apll_freq_4x12[new_index].mps >> 8;
diff --git a/drivers/cpufreq/exynos5250-cpufreq.c
b/drivers/cpufreq/exynos5250-cpufreq.c
index 736a5cf..b934486 100644
--- a/drivers/cpufreq/exynos5250-cpufreq.c
+++ b/drivers/cpufreq/exynos5250-cpufreq.c
@@ -143,7 +143,7 @@ static void set_apll(unsigned int new_index,

 }

-bool exynos5250_pms_change(unsigned int old_index, unsigned int new_index)
+static bool exynos5250_pms_change(unsigned int old_index, unsigned int
new_index)
 {
unsigned int old_pm = apll_freq_5250[old_index].mps >> 8;
unsigned int new_pm = apll_freq_5250[new_index].mps >> 8;
--
1.7.4.1

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


[PATCH 3/5] cpufreq: exynos: Use APLL_FREQ macro for cpu divider value

2012-12-07 Thread Jonghwan Choi
Signed-off-by: Jonghwan Choi 
---
 arch/arm/mach-exynos/include/mach/cpufreq.h |   16 ++
 drivers/cpufreq/exynos4210-cpufreq.c|  135 ++
 drivers/cpufreq/exynos4x12-cpufreq.c|  378
---
 drivers/cpufreq/exynos5250-cpufreq.c|  168 +++-
 4 files changed, 136 insertions(+), 561 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/cpufreq.h
b/arch/arm/mach-exynos/include/mach/cpufreq.h
index 39f0dc6..ddde0d8 100644
--- a/arch/arm/mach-exynos/include/mach/cpufreq.h
+++ b/arch/arm/mach-exynos/include/mach/cpufreq.h
@@ -18,6 +18,22 @@ enum cpufreq_level_index {
L20,
 };

+#define APLL_FREQ(f, a0, a1, a2, a3, a4, a5, a6, a7, b0, b1, b2, m, p, s)
\
+   {
\
+   .freq = (f) * 1000,
\
+   .clk_div_cpu0 = ((a0) | (a1) << 4 | (a2) << 8 | (a3) << 12 |
\
+   (a4) << 16 | (a5) << 20 | (a6) << 24 | (a7) << 28),
\
+   .clk_div_cpu1 = (b0 << 0 | b1 << 4 | b2 << 8),
\
+   .mps = ((m) << 16 | (p) << 8 | (s)),
\
+   }
+
+struct apll_freq {
+   unsigned int freq;
+   u32 clk_div_cpu0;
+   u32 clk_div_cpu1;
+   u32 mps;
+};
+
 struct exynos_dvfs_info {
unsigned long   mpll_freq_khz;
unsigned intpll_safe_idx;
diff --git a/drivers/cpufreq/exynos4210-cpufreq.c
b/drivers/cpufreq/exynos4210-cpufreq.c
index 5ae5c52..250dcf0 100644
--- a/drivers/cpufreq/exynos4210-cpufreq.c
+++ b/drivers/cpufreq/exynos4210-cpufreq.c
@@ -20,94 +20,37 @@
 #include 
 #include 

-#define CPUFREQ_LEVEL_END  L5
-
 static struct clk *cpu_clk;
 static struct clk *moutcore;
 static struct clk *mout_mpll;
 static struct clk *mout_apll;

-struct cpufreq_clkdiv {
-   unsigned int index;
-   unsigned int clkdiv;
-};
-
-static unsigned int exynos4210_volt_table[CPUFREQ_LEVEL_END] = {
+static unsigned int exynos4210_volt_table[] = {
125, 115, 105, 975000, 95,
 };

-
-static struct cpufreq_clkdiv exynos4210_clkdiv_table[CPUFREQ_LEVEL_END];
-
 static struct cpufreq_frequency_table exynos4210_freq_table[] = {
-   {L0, 1200*1000},
-   {L1, 1000*1000},
-   {L2, 800*1000},
-   {L3, 500*1000},
-   {L4, 200*1000},
+   {L0, 1200 * 1000},
+   {L1, 1000 * 1000},
+   {L2,  800 * 1000},
 
77,1  Top
+   {L1, 1000 * 1000},
+   {L2,  800 * 1000},
+   {L3,  500 * 1000},
+   {L4,  200 * 1000},
{0, CPUFREQ_TABLE_END},
 };

-static unsigned int clkdiv_cpu0[CPUFREQ_LEVEL_END][7] = {
+static struct apll_freq apll_freq_4210[] = {
/*
-* Clock divider value for following
-* { DIVCORE, DIVCOREM0, DIVCOREM1, DIVPERIPH,
-*  DIVATB, DIVPCLK_DBG, DIVAPLL }
+* values:
+* freq
+* clock divider for CORE, COREM0, COREM1, PERIPH, ATB, PCLK_DBG,
APLL, RESERVED
+* clock divider for COPY, HPM, RESERVED
+* PLL M, P, S
 */
-
-   /* ARM L0: 1200MHz */
-   { 0, 3, 7, 3, 4, 1, 7 },
-
-   /* ARM L1: 1000MHz */
-   { 0, 3, 7, 3, 4, 1, 7 },
-
-   /* ARM L2: 800MHz */
-   { 0, 3, 7, 3, 3, 1, 7 },
-
-   /* ARM L3: 500MHz */
-   { 0, 3, 7, 3, 3, 1, 7 },
-
-   /* ARM L4: 200MHz */
-   { 0, 1, 3, 1, 3, 1, 0 },
-};
-
-static unsigned int clkdiv_cpu1[CPUFREQ_LEVEL_END][2] = {
-   /*
-* Clock divider value for following
-* { DIVCOPY, DIVHPM }
-*/
-
-   /* ARM L0: 1200MHz */
-   { 5, 0 },
-
-   /* ARM L1: 1000MHz */
-   { 4, 0 },
-
-   /* ARM L2: 800MHz */
-   { 3, 0 },
-
-   /* ARM L3: 500MHz */
-   { 3, 0 },
-
-   /* ARM L4: 200MHz */
-   { 3, 0 },
-};
-
-static unsigned int exynos4210_apll_pms_table[CPUFREQ_LEVEL_END] = {
-   /* APLL FOUT L0: 1200MHz */
-   ((150 << 16) | (3 << 8) | 1),
-
-   /* APLL FOUT L1: 1000MHz */
-   ((250 << 16) | (6 << 8) | 1),
-
-   /* APLL FOUT L2: 800MHz */
-   ((200 << 16) | (6 << 8) | 1),
-
-   /* APLL FOUT L3: 500MHz */
-   ((250 << 16) | (6 << 8) | 2),
-
-   /* APLL FOUT L4: 200MHz */
-   ((200 << 16) | (6 << 8) | 3),
+   APLL_FREQ(1200, 0, 3, 7, 3, 4, 1, 7, 0, 5, 0, 0, 150, 3, 1),
+   APLL_FREQ(1000, 0, 3, 7, 3, 4, 1, 7, 0, 4, 0, 0, 250, 6, 1),
+   APLL_FREQ(800,  0, 3, 7, 3, 3, 1, 7, 0, 3, 0, 0, 200, 6, 1),
+   APLL_FREQ(500,  0, 3, 7, 3, 3, 1, 7, 0, 3, 0, 0, 250, 6, 2),
 
76,1   8%
+   APLL_FREQ(800,  0, 3, 7, 3, 3, 1, 7, 0, 3, 0, 0, 200, 6, 1),
+   APLL_FREQ(500,  0, 3, 7, 3, 3, 1, 7, 0, 3, 0, 0, 250, 6, 2),
+   APLL_FREQ(200,  0, 1, 3, 1, 3, 1, 0, 0, 3, 0, 0, 200, 6, 3),
 };

 static void exynos4210_set_clkdiv(unsigned int div_index)
@@ -116,7 +59,7 @@ static void exynos4210_set_clkdiv(unsigned int div_index)

/* Change Divider - CPU0 */

-   tmp = exynos4210_clkdiv_table[div_index].clkdiv;
+   tmp = apll_freq_4210[div_index].clk_div_cpu0;

__raw_writel(tmp, EXYNOS4_CLKDIV_CPU);

@@ -126,12 +69,7 @@ stat

[PATCH 4/5] cpufreq: exynos: Split exynos_target function into two functions

2012-12-07 Thread Jonghwan Choi
Split exynos_target function into exynos_target & exynos_cpufreq_scale.
Exynos_cpufreq_scale changes the voltage & frequency.

Signed-off-by: Jonghwan Choi 
---
 drivers/cpufreq/exynos-cpufreq.c |  151
+
 1 files changed, 86 insertions(+), 65 deletions(-)

diff --git a/drivers/cpufreq/exynos-cpufreq.c
b/drivers/cpufreq/exynos-cpufreq.c
index 82963a3..b0338e1 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -42,54 +42,55 @@ unsigned int exynos_getspeed(unsigned int cpu)
return clk_get_rate(exynos_info->cpu_clk) / 1000;
 }

-static int exynos_target(struct cpufreq_policy *policy,
- unsigned int target_freq,
- unsigned int relation)
+static int exynos_cpufreq_get_index(unsigned int freq)
+{
+   struct cpufreq_frequency_table *freq_table =
exynos_info->freq_table;
+   int index;
+
+   for (index = 0;
+   freq_table[index].frequency != CPUFREQ_TABLE_END; index++)
+   if (freq_table[index].frequency == freq)
+   break;
+
+   if (freq_table[index].frequency == CPUFREQ_TABLE_END)
+   return -EINVAL;
+
+   return index;
+}
+
+static int exynos_cpufreq_scale(unsigned int target_freq)
 {
-   unsigned int index, old_index;
-   unsigned int arm_volt, safe_arm_volt = 0;
-   int ret = 0;
struct cpufreq_frequency_table *freq_table =
exynos_info->freq_table;
unsigned int *volt_table = exynos_info->volt_table;
+   struct cpufreq_policy *policy = cpufreq_cpu_get(0);
+   unsigned int arm_volt, safe_arm_volt = 0;
unsigned int mpll_freq_khz = exynos_info->mpll_freq_khz;
-
-   mutex_lock(&cpufreq_lock);
+   unsigned int index, old_index;
+   int ret = 0;

freqs.old = policy->cur;
+   freqs.cpu = policy->cpu;

-   if (frequency_locked && target_freq != locking_frequency) {
-   ret = -EAGAIN;
+   if (target_freq == freqs.old)
goto out;
-   }

/*
 * The policy max have been changed so that we cannot get proper
 * old_index with cpufreq_frequency_table_target(). Thus, ignore
 * policy and get the index from the raw freqeuncy table.
 */
-   for (old_index = 0;
-   freq_table[old_index].frequency != CPUFREQ_TABLE_END;
-   old_index++)
-   if (freq_table[old_index].frequency == freqs.old)
-   break;
-
-   if (freq_table[old_index].frequency == CPUFREQ_TABLE_END) {
-   ret = -EINVAL;
"0004-cpufreq-exynos-Split-exynos_target-function-into-two.patch" 236L,
6451C
1,1   Top
-   if (freq_table[old_index].frequency == CPUFREQ_TABLE_END) {
-   ret = -EINVAL;
+   old_index = exynos_cpufreq_get_index(freqs.old);
+   if (old_index < 0) {
+   ret = old_index;
goto out;
}

-   if (cpufreq_frequency_table_target(policy, freq_table,
-  target_freq, relation, &index)) {
-   ret = -EINVAL;
+   index = exynos_cpufreq_get_index(target_freq);
+   if (index < 0) {
+   ret = index;
goto out;
}

-   freqs.new = freq_table[index].frequency;
-   freqs.cpu = policy->cpu;
-
-   if (freqs.new == freqs.old)
-   goto out;
-
/*
 * ARM clock source will be changed APLL to MPLL temporary
 * To support this level, need to control regulator for
@@ -108,13 +109,23 @@ static int exynos_target(struct cpufreq_policy
*policy,
/* When the new frequency is higher than current frequency */
if ((freqs.new > freqs.old) && !safe_arm_volt) {
/* Firstly, voltage up to increase frequency */
-   regulator_set_voltage(arm_regulator, arm_volt,
-   arm_volt);
+   ret = regulator_set_voltage(arm_regulator, arm_volt,
arm_volt);
+   if (ret) {
+   pr_err("%s: failed to set cpu voltage to %d\n",
+   __func__, arm_volt);
+   goto out;
+   }
}

-   if (safe_arm_volt)
-   regulator_set_voltage(arm_regulator, safe_arm_volt,
+   if (safe_arm_volt) {
+   ret = regulator_set_voltage(arm_regulator, safe_arm_volt,
  safe_arm_volt);
+   if (ret) {
+   pr_err("%s: failed to set cpu voltage to %d\n",
+   __func__, safe_arm_volt);
+   goto out;
+   }
+   }

exynos_info->set_freq(old_index, index);

@@ -126,8 +137,43 @@ static int exynos_target(struct cpufreq_policy *policy,
/* down the voltage after frequency change */
regulator_set_voltage(arm_regulator, arm_volt,

[PATCH 1/5] cpufreq: exynos: Remove unused variable & IS_ERR

2012-12-07 Thread Jonghwan Choi
The variable 'max_support_idx, min_support_idx, pm_lock_idx"
are never used, so remove the unused variable.

Signed-off-by: Jonghwan Choi 
---
 arch/arm/mach-exynos/include/mach/cpufreq.h |3 ---
 drivers/cpufreq/exynos-cpufreq.c|3 +--
 drivers/cpufreq/exynos4210-cpufreq.c|   15 +++
 drivers/cpufreq/exynos4x12-cpufreq.c|8 
 drivers/cpufreq/exynos5250-cpufreq.c|8 
 5 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-exynos/include/mach/cpufreq.h
b/arch/arm/mach-exynos/include/mach/cpufreq.h
index 7517c3f..39f0dc6 100644
--- a/arch/arm/mach-exynos/include/mach/cpufreq.h
+++ b/arch/arm/mach-exynos/include/mach/cpufreq.h
@@ -21,9 +21,6 @@ enum cpufreq_level_index {
 struct exynos_dvfs_info {
unsigned long   mpll_freq_khz;
unsigned intpll_safe_idx;
-   unsigned intpm_lock_idx;
-   unsigned intmax_support_idx;
-   unsigned intmin_support_idx;
struct clk  *cpu_clk;
unsigned int*volt_table;
struct cpufreq_frequency_table  *freq_table;
diff --git a/drivers/cpufreq/exynos-cpufreq.c
b/drivers/cpufreq/exynos-cpufreq.c
index af2d81e..5888aee 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -296,8 +296,7 @@ static int __init exynos_cpufreq_init(void)
 err_cpufreq:
unregister_pm_notifier(&exynos_cpufreq_nb);

-   if (!IS_ERR(arm_regulator))
-   regulator_put(arm_regulator);
+   regulator_put(arm_regulator);
 err_vdd_arm:
kfree(exynos_info);
pr_debug("%s: failed initialization\n", __func__);
diff --git a/drivers/cpufreq/exynos4210-cpufreq.c
b/drivers/cpufreq/exynos4210-cpufreq.c
index fb148fa..5ae5c52 100644
--- a/drivers/cpufreq/exynos4210-cpufreq.c
+++ b/drivers/cpufreq/exynos4210-cpufreq.c
@@ -22,9 +22,6 @@

 #define CPUFREQ_LEVEL_END  L5

-static int max_support_idx = L0;
-static int min_support_idx = (CPUFREQ_LEVEL_END - 1);
-
 static struct clk *cpu_clk;
 static struct clk *moutcore;
 static struct clk *mout_mpll;
@@ -276,10 +273,7 @@ int exynos4210_cpufreq_init(struct exynos_dvfs_info
*info)
}

info->mpll_freq_khz = rate;
-   info->pm_lock_idx = L2;
info->pll_safe_idx = L2;
-   info->max_support_idx = max_support_idx;
-   info->min_support_idx = min_support_idx;
info->cpu_clk = cpu_clk;
info->volt_table = exynos4210_volt_table;
info->freq_table = exynos4210_freq_table;
@@ -289,14 +283,11 @@ int exynos4210_cpufreq_init(struct exynos_dvfs_info
*info)
return 0;

 err_mout_apll:
-   if (!IS_ERR(mout_mpll))
-   clk_put(mout_mpll);
+   clk_put(mout_mpll);
"0001-cpufreq-exynos-Remove-unused-variable-IS_ERR.patch" 160L, 5092C
1,1   Top
-   clk_put(mout_mpll);
+   clk_put(mout_mpll);
 err_mout_mpll:
-   if (!IS_ERR(moutcore))
-   clk_put(moutcore);
+   clk_put(moutcore);
 err_moutcore:
-   if (!IS_ERR(cpu_clk))
-   clk_put(cpu_clk);
+   clk_put(cpu_clk);

pr_debug("%s: failed initialization\n", __func__);
return -EINVAL;
diff --git a/drivers/cpufreq/exynos4x12-cpufreq.c
b/drivers/cpufreq/exynos4x12-cpufreq.c
index 8c5a7af..29b41ab 100644
--- a/drivers/cpufreq/exynos4x12-cpufreq.c
+++ b/drivers/cpufreq/exynos4x12-cpufreq.c
@@ -22,9 +22,6 @@

 #define CPUFREQ_LEVEL_END  (L13 + 1)

-static int max_support_idx;
-static int min_support_idx = (CPUFREQ_LEVEL_END - 1);
-
 static struct clk *cpu_clk;
 static struct clk *moutcore;
 static struct clk *mout_mpll;
@@ -420,8 +417,6 @@ static void __init set_volt_table(void)
 {
unsigned int i;

-   max_support_idx = L1;
-
/* Not supported */
exynos4x12_freq_table[L0].frequency = CPUFREQ_ENTRY_INVALID;

@@ -511,10 +506,7 @@ int exynos4x12_cpufreq_init(struct exynos_dvfs_info
*info)
}

info->mpll_freq_khz = rate;
-   info->pm_lock_idx = L5;
info->pll_safe_idx = L7;
-   info->max_support_idx = max_support_idx;
-   info->min_support_idx = min_support_idx;
info->cpu_clk = cpu_clk;
info->volt_table = exynos4x12_volt_table;
info->freq_table = exynos4x12_freq_table;
diff --git a/drivers/cpufreq/exynos5250-cpufreq.c
b/drivers/cpufreq/exynos5250-cpufreq.c
index e64c253..8a5d733 100644
--- a/drivers/cpufreq/exynos5250-cpufreq.c
+++ b/drivers/cpufreq/exynos5250-cpufreq.c
@@ -23,8 +23,6 @@

 #define CPUFREQ_LEVEL_END  (L15 + 1)

-static int max_support_idx;
-static int min_support_idx = (CPUFREQ_LEVEL_END - 1);
 static struct clk *cpu_clk;
 static struct clk *moutcore;
 static struct clk *mout_mpll;
@@ -249,8 +247,6 @@ static void __init set_volt_table(void)
 {
unsigned int i;

-   max_support_idx = L0;
-
for (i = 0 ; i < CPUFREQ_LEVEL_END ; i++)
exynos5250_volt_table[i] = asv_voltage_5250[i];
 }
@@ -313,12 +309,8 @@ int exynos5250_cpufreq_init

[PATCH 2/5] cpufreq: exynos: Check old & new frequency early

2012-12-07 Thread Jonghwan Choi
If old & new freq have the same frequency, no need to call
cpufreq notifier & regulator function.

Signed-off-by: Jonghwan Choi 
---
 drivers/cpufreq/exynos-cpufreq.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/exynos-cpufreq.c
b/drivers/cpufreq/exynos-cpufreq.c
index 5888aee..82963a3 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -87,6 +87,9 @@ static int exynos_target(struct cpufreq_policy *policy,
freqs.new = freq_table[index].frequency;
freqs.cpu = policy->cpu;

+   if (freqs.new == freqs.old)
+   goto out;
+
/*
 * ARM clock source will be changed APLL to MPLL temporary
 * To support this level, need to control regulator for
@@ -112,8 +115,8 @@ static int exynos_target(struct cpufreq_policy *policy,
if (safe_arm_volt)
regulator_set_voltage(arm_regulator, safe_arm_volt,
  safe_arm_volt);
-   if (freqs.new != freqs.old)
-   exynos_info->set_freq(old_index, index);
+
+   exynos_info->set_freq(old_index, index);

cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);

--
1.7.4.1

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


Re: [PATCH V2 1/2] ASoC: Samsung: Do not register samsung audio dma device as pdev

2012-12-07 Thread Padma Venkat
Hi Mark,

On Fri, Dec 7, 2012 at 12:16 PM, Mark Brown
 wrote:
> On Thu, Dec 06, 2012 at 09:20:36AM +0530, Padmavathi Venna wrote:
>> Previously, the ASoC 'platform' (PCM/DMA) object was instantiated via a
>> platform_device. This didn't represent the hardware well, since there
>> was no separate hardware associated with this platform_device; it was a
>> virtual device with sole purpose to call snd_soc_register_platform().
>
> Looks good however this doesn't apply against my topic/samsung branch -
> can you please check if I need anything from Kukjin's tree?  Though I
> guess the easiest thing is just to wait until the merge window is over,
> we're near to the next release.

I will resend the patches re-based on your topic/samsung branch.

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