[PATCH] MAINTAINERS: update email address and cleanup for exynos entry

2014-11-13 Thread Kukjin Kim
Use kernel.org account instead of samsung.com and cleanup for Samsung
s3c, s5p and exynos SoCs.

Cc: Ben Dooks 
Signed-off-by: Kukjin Kim 
---
 MAINTAINERS |   16 
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 60b1163..b1e27bf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1308,30 +1308,22 @@ F:  drivers/*/*rockchip*
 F: drivers/*/*/*rockchip*
 F: sound/soc/rockchip/
 
-ARM/SAMSUNG ARM ARCHITECTURES
-M: Ben Dooks 
-M: Kukjin Kim 
+ARM/SAMSUNG EXYNOS ARM ARCHITECTURES
+M: Kukjin Kim 
 L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
 L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
-W: http://www.fluff.org/ben/linux/
 S: Maintained
 F: arch/arm/boot/dts/s3c*
 F: arch/arm/boot/dts/exynos*
 F: arch/arm/plat-samsung/
 F: arch/arm/mach-s3c24*/
 F: arch/arm/mach-s3c64xx/
+F: arch/arm/mach-s5p*/
+F: arch/arm/mach-exynos*/
 F: drivers/*/*s3c2410*
 F: drivers/*/*/*s3c2410*
 F: drivers/spi/spi-s3c*
 F: sound/soc/samsung/*
-
-ARM/S5P EXYNOS ARM ARCHITECTURES
-M: Kukjin Kim 
-L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
-L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
-S: Maintained
-F: arch/arm/mach-s5p*/
-F: arch/arm/mach-exynos*/
 N: exynos
 
 ARM/SAMSUNG MOBILE MACHINE SUPPORT
-- 
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


Re: [PATCH v2 2/2] drm/exynos/dsi: Add runtime PM so LCD power domain could be turned off

2014-11-13 Thread Krzysztof Kozlowski
On pią, 2014-11-14 at 11:53 +0900, Inki Dae wrote:
> On 2014년 11월 07일 22:53, Krzysztof Kozlowski wrote:
> > Add runtime Power Management to the Exynos DSI driver so the LCD power
> > domain could be turned off.
> > 
> > This slightly reduces the energy consumption when screen is completely
> > turned off. On Trats2 board when the system was idle the energy
> > consumption dropped by 1% (from 92.2 mA to 91.1 mA).
> > 
> > Before the patch:
> > $ cat cat /sys/kernel/debug/pm_genpd/pm_genpd_summary
> > lcd0-power-domain   on
> > /devices/11c0.fimd  suspended
> > /devices/11c8.dsi   unsupported
> > 
> > After applying the patch:
> > lcd0-power-domain   off
> > /devices/11c0.fimd  suspended
> > /devices/11c8.dsi   suspended
> 
> Reasonable but this patch incurs page flip test timeout like below,
> # modetest -v -s 15@12:720x1280
> trying to open device 'i915'...failed.
> trying to open device 'radeon'...failed.
> trying to open device 'nouveau'...failed.
> trying to open device 'vmwgfx'...failed.
> trying to open device 'omapdrm'...failed.
> trying to open device 'exynos'...success.
> setting mode 720x1280-0Hz@XR24 on connectors 15, crtc 12
> select timed out or error (ret 0)
> 
> I'm not sure why this issue is incurred with this patch even through
> this patch is reasonable and correct. So we need more checking.
> 
> P.S. I tested it on exynos-drm-next and m0 board.

Thanks for pointing this issue. I'll investigate it.

Best regards,
Krzysztof


--
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 6/7] ARM: dts: exynos4210-universal_c210: enable hdmi support

2014-11-13 Thread Andrzej Hajda
From: Tomasz Stanislawski 

This patch adds configuration of hw modules required to enable HDMI
support on Universal C210 board.

Signed-off-by: Tomasz Stanislawski 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/boot/dts/exynos4210-universal_c210.dts | 57 +
 1 file changed, 57 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210-universal_c210.dts 
b/arch/arm/boot/dts/exynos4210-universal_c210.dts
index d50eb3a..069b2e2 100644
--- a/arch/arm/boot/dts/exynos4210-universal_c210.dts
+++ b/arch/arm/boot/dts/exynos4210-universal_c210.dts
@@ -487,6 +487,63 @@
status = "okay";
};
};
+
+   hdmi_en: voltage-regulator-hdmi-5v {
+   compatible = "regulator-fixed";
+   regulator-name = "HDMI_5V";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   gpio = <&gpe0 1 0>;
+   enable-active-high;
+   };
+
+   hdmi_ddc: i2c-ddc {
+   compatible = "i2c-gpio";
+   gpios = <&gpe4 2 0 &gpe4 3 0>;
+   i2c-gpio,delay-us = <100>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   pinctrl-0 = <&i2c_ddc_bus>;
+   pinctrl-names = "default";
+   status = "okay";
+   };
+
+   mixer@12C1 {
+   status = "okay";
+   };
+
+   hdmi@12D0 {
+   hpd-gpio = <&gpx3 7 0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&hdmi_hpd>;
+   hdmi-en-supply = <&hdmi_en>;
+   vdd-supply = <&ldo3_reg>;
+   vdd_osc-supply = <&ldo4_reg>;
+   vdd_pll-supply = <&ldo3_reg>;
+   ddc = <&hdmi_ddc>;
+   status = "okay";
+   };
+
+   i2c@138E {
+   status = "okay";
+   };
+};
+
+&pinctrl_1 {
+   hdmi_hpd: hdmi-hpd {
+   samsung,pins = "gpx3-7";
+   samsung,pin-pud = <0>;
+   };
+};
+
+&pinctrl_0 {
+   i2c_ddc_bus: i2c-ddc-bus {
+   samsung,pins = "gpe4-2", "gpe4-3";
+   samsung,pin-function = <2>;
+   samsung,pin-pud = <3>;
+   samsung,pin-drv = <0>;
+   };
 };
 
 &mdma1 {
-- 
1.9.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 7/7] ARM: dts: exynos5250: add display power domain

2014-11-13 Thread Andrzej Hajda
The patch adds domain definition and references to it in appropriate devices.

Signed-off-by: Andrzej Hajda 
---
 arch/arm/boot/dts/exynos5250.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5250.dtsi 
b/arch/arm/boot/dts/exynos5250.dtsi
index f21b9aa..4fed676 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -100,6 +100,11 @@
reg = <0x10044040 0x20>;
};
 
+   pd_disp1: disp1-power-domain@100440A0 {
+   compatible = "samsung,exynos4210-pd";
+   reg = <0x100440A0 0x20>;
+   };
+
clock: clock-controller@1001 {
compatible = "samsung,exynos5250-clock";
reg = <0x1001 0x3>;
@@ -713,6 +718,7 @@
hdmi {
compatible = "samsung,exynos4212-hdmi";
reg = <0x1453 0x7>;
+   samsung,power-domain = <&pd_disp1>;
interrupts = <0 95 0>;
clocks = <&clock CLK_HDMI>, <&clock CLK_SCLK_HDMI>,
 <&clock CLK_SCLK_PIXEL>, <&clock CLK_SCLK_HDMIPHY>,
@@ -725,6 +731,7 @@
mixer {
compatible = "samsung,exynos5250-mixer";
reg = <0x1445 0x1>;
+   samsung,power-domain = <&pd_disp1>;
interrupts = <0 94 0>;
clocks = <&clock CLK_MIXER>, <&clock CLK_SCLK_HDMI>;
clock-names = "mixer", "sclk_hdmi";
@@ -737,6 +744,7 @@
};
 
dp-controller@145B {
+   samsung,power-domain = <&pd_disp1>;
clocks = <&clock CLK_DP>;
clock-names = "dp";
phys = <&dp_phy>;
@@ -744,6 +752,7 @@
};
 
fimd@1440 {
+   samsung,power-domain = <&pd_disp1>;
clocks = <&clock CLK_SCLK_FIMD1>, <&clock CLK_FIMD1>;
clock-names = "sclk_fimd", "fimd";
};
-- 
1.9.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 2/2] drm/exynos: use irq_flags instead of triggering

2014-11-13 Thread YoungJun Cho

Hi JoonYoung,

On 11/14/2014 02:12 PM, Joonyoung Shim wrote:

Hi,

On 11/14/2014 02:01 PM, YoungJun Cho wrote:

Hi JoonYoung,

On 11/14/2014 11:36 AM, Joonyoung Shim wrote:

The drm_handle_vblank should be called whenever be vsync, te interrupt
means vsync on i80 interface.


That's right.



Signed-off-by: Joonyoung Shim 
---
Based on lastest exynos-drm-next branch and patch of Youngjun Cho
("drm/exynos: fimd: move handle vblank position in TE handler").

   drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 033b18b..5cc57f7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -984,7 +984,7 @@ static void fimd_te_handler(struct exynos_drm_manager *mgr)
   wake_up(&ctx->wait_vsync_queue);
   }

-if (!atomic_read(&ctx->triggering))
+if (test_bit(0, &ctx->irq_flags))
   drm_handle_vblank(ctx->drm_dev, ctx->pipe);


But after triggering, "fimd_irq_handler()" is called by "lcd_sys" interrupt and that 
calls "drm_handle_vblank()".



I missed the routine but i think drm_handle_vblank should be called by
vsync interrupt handler. As you know, fimd_irq_handler is not vsync
interrupt handler on i80 interface.


That sounds reasonable.
For that, we should modify "fimd_irq_handler()" not to call 
"drm_handle_vblank()" in I80 interface.


Thank you.
Best regards YJ




So I think "fimd_te_handler()" calls "drm_handle_vblank()" only non-triggering 
condition.

Thank you.
Best regards YJ


   }










--
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 2/2] drm/exynos: use irq_flags instead of triggering

2014-11-13 Thread Joonyoung Shim
Hi,

On 11/14/2014 02:01 PM, YoungJun Cho wrote:
> Hi JoonYoung,
> 
> On 11/14/2014 11:36 AM, Joonyoung Shim wrote:
>> The drm_handle_vblank should be called whenever be vsync, te interrupt
>> means vsync on i80 interface.
> 
> That's right.
> 
>>
>> Signed-off-by: Joonyoung Shim 
>> ---
>> Based on lastest exynos-drm-next branch and patch of Youngjun Cho
>> ("drm/exynos: fimd: move handle vblank position in TE handler").
>>
>>   drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index 033b18b..5cc57f7 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -984,7 +984,7 @@ static void fimd_te_handler(struct exynos_drm_manager 
>> *mgr)
>>   wake_up(&ctx->wait_vsync_queue);
>>   }
>>
>> -if (!atomic_read(&ctx->triggering))
>> +if (test_bit(0, &ctx->irq_flags))
>>   drm_handle_vblank(ctx->drm_dev, ctx->pipe);
> 
> But after triggering, "fimd_irq_handler()" is called by "lcd_sys" interrupt 
> and that calls "drm_handle_vblank()".
> 

I missed the routine but i think drm_handle_vblank should be called by
vsync interrupt handler. As you know, fimd_irq_handler is not vsync
interrupt handler on i80 interface.

> So I think "fimd_te_handler()" calls "drm_handle_vblank()" only 
> non-triggering condition.
> 
> Thank you.
> Best regards YJ
> 
>>   }
>>
>>
> 
> 

--
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 2/2] drm/exynos: use irq_flags instead of triggering

2014-11-13 Thread YoungJun Cho

Hi JoonYoung,

On 11/14/2014 11:36 AM, Joonyoung Shim wrote:

The drm_handle_vblank should be called whenever be vsync, te interrupt
means vsync on i80 interface.


That's right.



Signed-off-by: Joonyoung Shim 
---
Based on lastest exynos-drm-next branch and patch of Youngjun Cho
("drm/exynos: fimd: move handle vblank position in TE handler").

  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 033b18b..5cc57f7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -984,7 +984,7 @@ static void fimd_te_handler(struct exynos_drm_manager *mgr)
wake_up(&ctx->wait_vsync_queue);
}

-   if (!atomic_read(&ctx->triggering))
+   if (test_bit(0, &ctx->irq_flags))
drm_handle_vblank(ctx->drm_dev, ctx->pipe);


But after triggering, "fimd_irq_handler()" is called by "lcd_sys" 
interrupt and that calls "drm_handle_vblank()".


So I think "fimd_te_handler()" calls "drm_handle_vblank()" only 
non-triggering condition.


Thank you.
Best regards YJ


  }




--
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] drm/exynos: Fix DSI resuming fail because power domain being off

2014-11-13 Thread Inki Dae
On 2014년 11월 07일 22:53, Krzysztof Kozlowski wrote:
> During system resume from suspend to RAM the Exynos DRM driver forced
> CRTC mode thus turning display on (DPMS_ON). This lead to runtime resuming
> of DSI which failed because whole LCD power domain was off and it was
> not allowed to turn on because of system resume in progress.
> 
> Forcing mode should not be needed and removing it solves this particular
> problem.

only this patch, Applied.

Thanks,
Inki Dae

> 
> This necessary fix for following scenario reproduced on Exynos DRM:
> 1. Power domain is off before suspending the system.
> 2. System is suspended to RAM.
> 3. Resuming starts. The Exynos DRM driver resume callback is called.
> 4. The Exynos DRM driver calls drm_helper_resume_force_mode() which turns
>on the screen by calling exynos_dsi_dpms with DRM_MODE_DPMS_ON.
> 5. The Exynos DSI driver calls pm_runtime_get. The driver runtime
>resumes and this should turn LCD power domain on.
> 6. Unfortunately the domain cannot be turned on because system resume is
>in progress and genpd->prepared_count is positive.
> 
> Steps to reproduce:
> 1. Add runtime PM to Exynos DSI driver.
> 2. Build Exynos DRM/FB without FRAMEBUFFER_CONSOLE.
> 3. Enable the connector and screen (e.g. with modeset-vsync).
> 4. echo 3 > /sys/devices/platform/exynos-drm/graphics/fb0/blank
> 5. echo mem > /sys/power/state
> 6. Resume.
> [   77.712469] PM: early resume of devices complete after 3.854 msecs
> [   77.712739] exynos-dsi 11c8.dsi: pm_genpd_resume()
> [   77.712758] exynos4-fimc 1180.fimc: pm_genpd_resume()
> [   77.712774] exynos4-fimc 1181.fimc: pm_genpd_resume()
> [   77.712787] exynos-drm-fimc 1182.fimc: pm_genpd_resume()
> [   77.712802] exynos-drm-fimc 1183.fimc: pm_genpd_resume()
> [   77.712815] s5p-mipi-csis 1188.csis: pm_genpd_resume()
> [   77.712829] s5p-mipi-csis 1189.csis: pm_genpd_resume()
> [   77.712843] exynos-fimc-lite 1239.fimc-lite: pm_genpd_resume()
> [   77.712856] exynos-fimc-lite 123a.fimc-lite: pm_genpd_resume()
> [   77.713788] exynos4-fb 11c0.fimd: pm_genpd_resume()
> [   77.713912] wake disabled for irq 184
> [   77.713923] wake disabled for irq 185
> [   77.714082] wake disabled for irq 173
> [   77.715676] wake disabled for irq 176
> [   77.718540] exynos4-fb 11c0.fimd: pm_genpd_runtime_resume()
> [   77.718567] exynos4-fb 11c0.fimd: state restore latency exceeded, new 
> value 1708 ns
> [   77.718636] exynos-dsi 11c8.dsi: pm_genpd_runtime_resume()
> [   77.892366] exynos-dsi 11c8.dsi: PLL failed to stabilize
> [   77.892377] exynos-dsi 11c8.dsi: failed to configure DSI PLL
> [   78.192168] exynos-dsi 11c8.dsi: timeout waiting for reset
> [   78.211578] exynos-dsi 11c8.dsi: waiting for bus lanes timed out
> [   78.307173] exynos-dsi 11c8.dsi: xfer timed out: d1 00 (null)
> [   78.307190] panel_s6e8aa0 11c8.dsi.0: error -110 reading dcs seq(0xd1)
> [   78.307199] panel_s6e8aa0 11c8.dsi.0: read id failed
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index d32165a7f862..8f7110c9d21f 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -200,8 +200,6 @@ static int exynos_drm_resume(struct drm_device *dev)
>   }
>   drm_modeset_unlock_all(dev);
>  
> - drm_helper_resume_force_mode(dev);
> -
>   return 0;
>  }
>  
> 

--
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] drm/exynos: add has_vtsel flag

2014-11-13 Thread Inki Dae
On 2014년 11월 14일 11:36, Joonyoung Shim wrote:
> The exynos fimd provides video type selection bits from system register
> but exynos3 series don't has it, so needs has_vtsel flag and we can
> distinguish whether set video type selection bits.

Applied.

Thanks,
Inki Dae

> 
> Signed-off-by: Joonyoung Shim 
> ---
> Changelog from v1:
> - rebase on latest exynos-drm-next branch
> - add has_vtsel for exynos4415
> 
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 5cc57f7..93b263e 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -96,6 +96,7 @@ struct fimd_driver_data {
>   unsigned int has_clksel:1;
>   unsigned int has_limited_fmt:1;
>   unsigned int has_vidoutcon:1;
> + unsigned int has_vtsel:1;
>  };
>  
>  static struct fimd_driver_data s3c64xx_fimd_driver_data = {
> @@ -118,6 +119,7 @@ static struct fimd_driver_data exynos4_fimd_driver_data = 
> {
>   .lcdblk_vt_shift = 10,
>   .lcdblk_bypass_shift = 1,
>   .has_shadowcon = 1,
> + .has_vtsel = 1,
>  };
>  
>  static struct fimd_driver_data exynos4415_fimd_driver_data = {
> @@ -127,6 +129,7 @@ static struct fimd_driver_data 
> exynos4415_fimd_driver_data = {
>   .lcdblk_bypass_shift = 1,
>   .has_shadowcon = 1,
>   .has_vidoutcon = 1,
> + .has_vtsel = 1,
>  };
>  
>  static struct fimd_driver_data exynos5_fimd_driver_data = {
> @@ -136,6 +139,7 @@ static struct fimd_driver_data exynos5_fimd_driver_data = 
> {
>   .lcdblk_bypass_shift = 15,
>   .has_shadowcon = 1,
>   .has_vidoutcon = 1,
> + .has_vtsel = 1,
>  };
>  
>  struct fimd_win_data {
> @@ -354,7 +358,8 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
>   writel(0, timing_base + I80IFCONFBx(0));
>  
>   /* set video type selection to I80 interface */
> - if (ctx->sysreg && regmap_update_bits(ctx->sysreg,
> + if (driver_data->has_vtsel && ctx->sysreg &&
> + regmap_update_bits(ctx->sysreg,
>   driver_data->lcdblk_offset,
>   0x3 << driver_data->lcdblk_vt_shift,
>   0x1 << driver_data->lcdblk_vt_shift)) {
> 

--
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 2/2] drm/exynos/dsi: Add runtime PM so LCD power domain could be turned off

2014-11-13 Thread Inki Dae
On 2014년 11월 07일 22:53, Krzysztof Kozlowski wrote:
> Add runtime Power Management to the Exynos DSI driver so the LCD power
> domain could be turned off.
> 
> This slightly reduces the energy consumption when screen is completely
> turned off. On Trats2 board when the system was idle the energy
> consumption dropped by 1% (from 92.2 mA to 91.1 mA).
> 
> Before the patch:
> $ cat cat /sys/kernel/debug/pm_genpd/pm_genpd_summary
> lcd0-power-domain   on
> /devices/11c0.fimd  suspended
> /devices/11c8.dsi   unsupported
> 
> After applying the patch:
> lcd0-power-domain   off
> /devices/11c0.fimd  suspended
> /devices/11c8.dsi   suspended

Reasonable but this patch incurs page flip test timeout like below,
# modetest -v -s 15@12:720x1280
trying to open device 'i915'...failed.
trying to open device 'radeon'...failed.
trying to open device 'nouveau'...failed.
trying to open device 'vmwgfx'...failed.
trying to open device 'omapdrm'...failed.
trying to open device 'exynos'...success.
setting mode 720x1280-0Hz@XR24 on connectors 15, crtc 12
select timed out or error (ret 0)

I'm not sure why this issue is incurred with this patch even through
this patch is reasonable and correct. So we need more checking.

P.S. I tested it on exynos-drm-next and m0 board.

Thanks,
Inki Dae

> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
> b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 24741d8758e8..19ed36d2d557 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -1356,6 +1357,8 @@ static int exynos_dsi_enable(struct exynos_dsi *dsi)
>   if (dsi->state & DSIM_STATE_ENABLED)
>   return 0;
>  
> + pm_runtime_get_sync(dsi->dev);
> +
>   ret = exynos_dsi_poweron(dsi);
>   if (ret < 0)
>   return ret;
> @@ -1392,6 +1395,8 @@ static void exynos_dsi_disable(struct exynos_dsi *dsi)
>   drm_panel_unprepare(dsi->panel);
>   exynos_dsi_poweroff(dsi);
>  
> + pm_runtime_put_sync(dsi->dev);
> +
>   dsi->state &= ~DSIM_STATE_ENABLED;
>  }
>  
> @@ -1772,6 +1777,8 @@ static int exynos_dsi_probe(struct platform_device 
> *pdev)
>   if (ret)
>   goto err_del_component;
>  
> + pm_runtime_enable(&pdev->dev);
> +
>   return ret;
>  
>  err_del_component:
> @@ -1781,6 +1788,8 @@ err_del_component:
>  
>  static int exynos_dsi_remove(struct platform_device *pdev)
>  {
> + pm_runtime_disable(&pdev->dev);
> +
>   component_del(&pdev->dev, &exynos_dsi_component_ops);
>   exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR);
>  
> 

--
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: exynos5250/arndale: failed to set cpu voltage

2014-11-13 Thread Abhilash Kesavan
Hello Tyler,

On Fri, Nov 14, 2014 at 3:30 AM, Tyler Baker  wrote:
> In recent upstream kernels, exynos5420-based arndale boards have been

Boot logs are only for 5250, typo ?

> producing boot-time errors due to the fact they failed to set the cpu
> voltage. These message flood the serial console even after userspace
> has been loaded, yielding the console unusable without forcing a lower
> log level. These errors are produced _only_ with the
> multi_v7_defconfig and they are _not_ present
> with exynos_defconfig. Here are some recent boot logs showing the boot errors:
>
> mainline/v3.18-rc4-65-g2c54396:
> multi_v7_defconfig:
> 
> http://storage.armcloud.us/kernel-ci/mainline/v3.18-rc4-65-g2c54396/arm-multi_v7_defconfig/boot-exynos5250-arndale.html
> exynos_defconfig:
> 
> http://storage.armcloud.us/kernel-ci/mainline/v3.18-rc4-65-g2c54396/arm-exynos_defconfig/boot-exynos5250-arndale.html

>From the boot logs it appears that the S5M8767 regulator does not get
probed with multi_v7_defconfig and you get the following messages:

[1.147412] deviceless supply vdd_arm not found, using dummy regulator
[1.152669] exynos-cpufreq exynos-cpufreq: failed to set cpu
voltage to 130
[1.159771] cpufreq: __target_index: Failed to change cpu frequency: -22

Both multi_v7_defconfig and exynos_defconfig have the S5M8767
regulator enabled. However multi_v7_defconfig does not have the S3C
I2C controller enabled while exynos_defconfig does.
Can you re-check after enabling CONFIG_I2C_S3C2410 ?

Regards,
Abhilash

>
> next/next-20141113:
> multi_v7_defconfig:
>     
> http://storage.armcloud.us/kernel-ci/next/next-20141113/arm-multi_v7_defconfig/boot-exynos5250-arndale.html
> exynos_defconfig:
> 
> http://storage.armcloud.us/kernel-ci/next/next-20141113/arm-exynos_defconfig/boot-exynos5250-arndale.html
>
> arm-soc/v3.18-rc4-185-gbfcf8f9:
> multi_v7_defconfig:
> 
> http://storage.armcloud.us/kernel-ci/arm-soc/v3.18-rc4-185-gbfcf8f9/arm-multi_v7_defconfig/boot-exynos5250-arndale.html
> exynos_defconfig:
> 
> http://storage.armcloud.us/kernel-ci/arm-soc/v3.18-rc4-185-gbfcf8f9/arm-exynos_defconfig/boot-exynos5250-arndale.html
>
> Cheers,
>
> --
> Tyler Baker
> Tech Lead, LAVA
> Linaro.org | Open source software for ARM SoCs
> Follow Linaro: http://www.facebook.com/pages/Linaro
> http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
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 v2] drm/exynos: add has_vtsel flag

2014-11-13 Thread Joonyoung Shim
The exynos fimd provides video type selection bits from system register
but exynos3 series don't has it, so needs has_vtsel flag and we can
distinguish whether set video type selection bits.

Signed-off-by: Joonyoung Shim 
---
Changelog from v1:
- rebase on latest exynos-drm-next branch
- add has_vtsel for exynos4415

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 5cc57f7..93b263e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -96,6 +96,7 @@ struct fimd_driver_data {
unsigned int has_clksel:1;
unsigned int has_limited_fmt:1;
unsigned int has_vidoutcon:1;
+   unsigned int has_vtsel:1;
 };
 
 static struct fimd_driver_data s3c64xx_fimd_driver_data = {
@@ -118,6 +119,7 @@ static struct fimd_driver_data exynos4_fimd_driver_data = {
.lcdblk_vt_shift = 10,
.lcdblk_bypass_shift = 1,
.has_shadowcon = 1,
+   .has_vtsel = 1,
 };
 
 static struct fimd_driver_data exynos4415_fimd_driver_data = {
@@ -127,6 +129,7 @@ static struct fimd_driver_data exynos4415_fimd_driver_data 
= {
.lcdblk_bypass_shift = 1,
.has_shadowcon = 1,
.has_vidoutcon = 1,
+   .has_vtsel = 1,
 };
 
 static struct fimd_driver_data exynos5_fimd_driver_data = {
@@ -136,6 +139,7 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
.lcdblk_bypass_shift = 15,
.has_shadowcon = 1,
.has_vidoutcon = 1,
+   .has_vtsel = 1,
 };
 
 struct fimd_win_data {
@@ -354,7 +358,8 @@ static void fimd_commit(struct exynos_drm_manager *mgr)
writel(0, timing_base + I80IFCONFBx(0));
 
/* set video type selection to I80 interface */
-   if (ctx->sysreg && regmap_update_bits(ctx->sysreg,
+   if (driver_data->has_vtsel && ctx->sysreg &&
+   regmap_update_bits(ctx->sysreg,
driver_data->lcdblk_offset,
0x3 << driver_data->lcdblk_vt_shift,
0x1 << driver_data->lcdblk_vt_shift)) {
-- 
1.9.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 1/2] drm/exynos: move triggering checking

2014-11-13 Thread Joonyoung Shim
It's better to be checking whether triggerring in fimd_trigger function.
Also it will return if in triggerring on fimd_te_handler, then it can't
execute remain codes.

Signed-off-by: Joonyoung Shim 
---
Based on lastest exynos-drm-next branch.

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 7593f62..033b18b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -944,6 +944,13 @@ static void fimd_trigger(struct device *dev)
void *timing_base = ctx->regs + driver_data->timing_base;
u32 reg;
 
+/*
+* Skips to trigger if in triggering state, because multiple triggering
+* requests can cause panel reset.
+*/
+   if (atomic_read(&ctx->triggering))
+   return;
+
atomic_set(&ctx->triggering, 1);
 
reg = readl(ctx->regs + VIDINTCON0);
@@ -964,13 +971,6 @@ static void fimd_te_handler(struct exynos_drm_manager *mgr)
if (ctx->pipe < 0 || !ctx->drm_dev)
return;
 
-/*
-* Skips to trigger if in triggering state, because multiple triggering
-* requests can cause panel reset.
-*/
-   if (atomic_read(&ctx->triggering))
-   return;
-
/*
 * If there is a page flip request, triggers and handles the page flip
 * event so that current fb can be updated into panel GRAM.
-- 
1.9.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 2/2] drm/exynos: use irq_flags instead of triggering

2014-11-13 Thread Joonyoung Shim
The drm_handle_vblank should be called whenever be vsync, te interrupt
means vsync on i80 interface.

Signed-off-by: Joonyoung Shim 
---
Based on lastest exynos-drm-next branch and patch of Youngjun Cho
("drm/exynos: fimd: move handle vblank position in TE handler").

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 033b18b..5cc57f7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -984,7 +984,7 @@ static void fimd_te_handler(struct exynos_drm_manager *mgr)
wake_up(&ctx->wait_vsync_queue);
}
 
-   if (!atomic_read(&ctx->triggering))
+   if (test_bit(0, &ctx->irq_flags))
drm_handle_vblank(ctx->drm_dev, ctx->pipe);
 }
 
-- 
1.9.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


exynos5250/arndale: failed to set cpu voltage

2014-11-13 Thread Tyler Baker
In recent upstream kernels, exynos5420-based arndale boards have been
producing boot-time errors due to the fact they failed to set the cpu
voltage. These message flood the serial console even after userspace
has been loaded, yielding the console unusable without forcing a lower
log level. These errors are produced _only_ with the
multi_v7_defconfig and they are _not_ present
with exynos_defconfig. Here are some recent boot logs showing the boot errors:

mainline/v3.18-rc4-65-g2c54396:
multi_v7_defconfig:

http://storage.armcloud.us/kernel-ci/mainline/v3.18-rc4-65-g2c54396/arm-multi_v7_defconfig/boot-exynos5250-arndale.html
exynos_defconfig:

http://storage.armcloud.us/kernel-ci/mainline/v3.18-rc4-65-g2c54396/arm-exynos_defconfig/boot-exynos5250-arndale.html

next/next-20141113:
multi_v7_defconfig:

http://storage.armcloud.us/kernel-ci/next/next-20141113/arm-multi_v7_defconfig/boot-exynos5250-arndale.html
exynos_defconfig:

http://storage.armcloud.us/kernel-ci/next/next-20141113/arm-exynos_defconfig/boot-exynos5250-arndale.html

arm-soc/v3.18-rc4-185-gbfcf8f9:
multi_v7_defconfig:

http://storage.armcloud.us/kernel-ci/arm-soc/v3.18-rc4-185-gbfcf8f9/arm-multi_v7_defconfig/boot-exynos5250-arndale.html
exynos_defconfig:

http://storage.armcloud.us/kernel-ci/arm-soc/v3.18-rc4-185-gbfcf8f9/arm-exynos_defconfig/boot-exynos5250-arndale.html

Cheers,

-- 
Tyler Baker
Tech Lead, LAVA
Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
--
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 v3 1/2] usb: dwc2/gadget: add mutex to serialize init/deinit calls

2014-11-13 Thread Paul Zimmerman
> From: Marek Szyprowski [mailto:m.szyprow...@samsung.com]
> Sent: Thursday, November 13, 2014 7:18 AM
> 
> On 2014-10-31 19:46, Paul Zimmerman wrote:
> >> From: Marek Szyprowski [mailto:m.szyprow...@samsung.com]
> >> Sent: Friday, October 31, 2014 3:13 AM
> >>
> >> This patch adds mutex, which protects initialization and
> >> deinitialization procedures against suspend/resume methods.
> >>
> >> Signed-off-by: Marek Szyprowski 
> >> ---
> >>   drivers/usb/dwc2/core.h   |  1 +
> >>   drivers/usb/dwc2/gadget.c | 20 
> >>   2 files changed, 21 insertions(+)
> >>
> >> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> >> index 9f77b4d1c5ff..58732a9a0019 100644
> >> --- a/drivers/usb/dwc2/core.h
> >> +++ b/drivers/usb/dwc2/core.h
> >> @@ -187,6 +187,7 @@ struct s3c_hsotg {
> >>struct s3c_hsotg_plat*plat;
> >>
> >>spinlock_t  lock;
> >> +  struct mutexinit_mutex;
> >>
> >>void __iomem*regs;
> >>int irq;
> >> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> >> index d8dda39c9e16..a2e4272a904e 100644
> >> --- a/drivers/usb/dwc2/gadget.c
> >> +++ b/drivers/usb/dwc2/gadget.c
> >> @@ -21,6 +21,7 @@
> >>   #include 
> >>   #include 
> >>   #include 
> >> +#include 
> >>   #include 
> >>   #include 
> >>   #include 
> >> @@ -2908,6 +2909,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget 
> >> *gadget,
> >>return -EINVAL;
> >>}
> >>
> >> +  mutex_lock(&hsotg->init_mutex);
> >>WARN_ON(hsotg->driver);
> >>
> >>driver->driver.bus = NULL;
> >> @@ -2933,9 +2935,12 @@ static int s3c_hsotg_udc_start(struct usb_gadget 
> >> *gadget,
> >>
> >>dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);
> >>
> >> +  mutex_unlock(&hsotg->init_mutex);
> >> +
> >>return 0;
> >>
> >>   err:
> >> +  mutex_unlock(&hsotg->init_mutex);
> >>hsotg->driver = NULL;
> >>return ret;
> >>   }
> >> @@ -2957,6 +2962,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget 
> >> *gadget,
> >>if (!hsotg)
> >>return -ENODEV;
> >>
> >> +  mutex_lock(&hsotg->init_mutex);
> >> +
> >>/* all endpoints should be shutdown */
> >>for (ep = 1; ep < hsotg->num_of_eps; ep++)
> >>s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
> >> @@ -2974,6 +2981,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget 
> >> *gadget,
> >>
> >>clk_disable(hsotg->clk);
> >>
> >> +  mutex_unlock(&hsotg->init_mutex);
> >> +
> >>return 0;
> >>   }
> >>
> >> @@ -3002,6 +3011,7 @@ static int s3c_hsotg_pullup(struct usb_gadget 
> >> *gadget, int is_on)
> >>
> >>dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on);
> >>
> >> +  mutex_lock(&hsotg->init_mutex);
> >>spin_lock_irqsave(&hsotg->lock, flags);
> >>if (is_on) {
> >>clk_enable(hsotg->clk);
> >> @@ -3013,6 +3023,7 @@ static int s3c_hsotg_pullup(struct usb_gadget 
> >> *gadget, int is_on)
> >>
> >>hsotg->gadget.speed = USB_SPEED_UNKNOWN;
> >>spin_unlock_irqrestore(&hsotg->lock, flags);
> >> +  mutex_unlock(&hsotg->init_mutex);
> >>
> >>return 0;
> >>   }
> >> @@ -3507,6 +3518,7 @@ static int s3c_hsotg_probe(struct platform_device 
> >> *pdev)
> >>}
> >>
> >>spin_lock_init(&hsotg->lock);
> >> +  mutex_init(&hsotg->init_mutex);
> >>
> >>hsotg->irq = ret;
> >>
> >> @@ -3652,6 +3664,8 @@ static int s3c_hsotg_suspend(struct platform_device 
> >> *pdev, pm_message_t
> state)
> >>unsigned long flags;
> >>int ret = 0;
> >>
> >> +  mutex_lock(&hsotg->init_mutex);
> >> +
> >>if (hsotg->driver)
> >>dev_info(hsotg->dev, "suspending usb gadget %s\n",
> >> hsotg->driver->driver.name);
> >> @@ -3674,6 +3688,8 @@ static int s3c_hsotg_suspend(struct platform_device 
> >> *pdev, pm_message_t
> state)
> >>clk_disable(hsotg->clk);
> >>}
> >>
> >> +  mutex_unlock(&hsotg->init_mutex);
> >> +
> >>return ret;
> >>   }
> >>
> >> @@ -3683,7 +3699,9 @@ static int s3c_hsotg_resume(struct platform_device 
> >> *pdev)
> >>unsigned long flags;
> >>int ret = 0;
> >>
> >> +  mutex_lock(&hsotg->init_mutex);
> >>if (hsotg->driver) {
> >> +
> >>dev_info(hsotg->dev, "resuming usb gadget %s\n",
> >> hsotg->driver->driver.name);
> >>
> >> @@ -3699,6 +3717,8 @@ static int s3c_hsotg_resume(struct platform_device 
> >> *pdev)
> >>s3c_hsotg_core_connect(hsotg);
> >>spin_unlock_irqrestore(&hsotg->lock, flags);
> >>
> >> +  mutex_unlock(&hsotg->init_mutex);
> >> +
> >>return ret;
> >>   }
> >>
> > Hmm. I can't find any other UDC driver that uses a mutex in its
> > suspend/resume functions. Can you explain why this is needed only
> > for dwc2?
> 
> I've posted this version because I thought you were not convinced that
> the patch
> "usb: dwc2/gadget: rework suspend/resume code to correctly restore
> gadget state"
> can add code for initialization and deinitialization in suspend/resume
> paths.

My proble

RE: [PATCH v3] usb: dwc2/gadget: report disconnect event from 'end session' irq

2014-11-13 Thread Paul Zimmerman
> From: Marek Szyprowski [mailto:m.szyprow...@samsung.com]
> Sent: Thursday, November 13, 2014 5:40 AM
> 
> On 2014-10-31 19:15, Paul Zimmerman wrote:
> >> From: Marek Szyprowski [mailto:m.szyprow...@samsung.com]
> >> Sent: Friday, October 31, 2014 1:04 AM
> >> To: linux-...@vger.kernel.org; linux-samsung-soc@vger.kernel.org
> >> Cc: Marek Szyprowski; Kyungmin Park; Robert Baldyga; Paul Zimmerman; 
> >> Krzysztof Kozlowski; Felipe
> Balbi
> >> Subject: [PATCH v3] usb: dwc2/gadget: report disconnect event from 'end 
> >> session' irq
> >>
> >> This patch adds a call to s3c_hsotg_disconnect() from 'end session'
> >> interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem
> >> about unplugged usb cable. 'disconnected' interrupt (DISCONNINT) might
> >> look a bit more suitable for this event, but it is asserted only in
> >> host mode, so in device mode we need to use something else.
> >>
> >> Additional check has been added in s3c_hsotg_disconnect() function
> >> to ensure that the event is reported only once after successful device
> >> enumeration.
> >>
> >> Signed-off-by: Marek Szyprowski 
> >> ---
> >>   drivers/usb/dwc2/core.h   |  1 +
> >>   drivers/usb/dwc2/gadget.c | 10 ++
> >>   2 files changed, 11 insertions(+)
> >>
> >> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> >> index 55c90c53f2d6..b42df32e7737 100644
> >> --- a/drivers/usb/dwc2/core.h
> >> +++ b/drivers/usb/dwc2/core.h
> >> @@ -212,6 +212,7 @@ struct s3c_hsotg {
> >>struct usb_gadget   gadget;
> >>unsigned intsetup;
> >>unsigned long   last_rst;
> >> +  unsigned intaddress;
> >>struct s3c_hsotg_ep *eps;
> >>   };
> >>
> >> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> >> index fcd2bb55ccca..6304efba11aa 100644
> >> --- a/drivers/usb/dwc2/gadget.c
> >> +++ b/drivers/usb/dwc2/gadget.c
> >> @@ -1114,6 +1114,7 @@ static void s3c_hsotg_process_control(struct 
> >> s3c_hsotg *hsotg,
> >> DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK;
> >>writel(dcfg, hsotg->regs + DCFG);
> >>
> >> +  hsotg->address = ctrl->wValue;
> >>dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);
> >>
> >>ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0);
> >> @@ -2031,6 +2032,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg 
> >> *hsotg)
> >>   {
> >>unsigned ep;
> >>
> >> +  if (!hsotg->address)
> >> +  return;
> >> +
> >> +  hsotg->address = 0;
> >>for (ep = 0; ep < hsotg->num_of_eps; ep++)
> >>kill_all_requests(hsotg, &hsotg->eps[ep], -ESHUTDOWN, true);
> >>
> >> @@ -2290,6 +2295,11 @@ irq_retry:
> >>dev_info(hsotg->dev, "OTGInt: %08x\n", otgint);
> >>
> >>writel(otgint, hsotg->regs + GOTGINT);
> >> +
> >> +  if (otgint & GOTGINT_SES_END_DET) {
> >> +  s3c_hsotg_disconnect(hsotg);
> >> +  hsotg->gadget.speed = USB_SPEED_UNKNOWN;
> >> +  }
> >>}
> >>
> >>if (gintsts & GINTSTS_SESSREQINT) {
> > I don't think this is right. The host can send control requests to
> > the device before it sends a SetAddress to change from the default
> > address of 0. So if a GOTGINT_SES_END_DET happens before the
> > SetAddress, it will be ignored.
> >
> > Or am I missing something?
> 
> Well, right. However before finishing enumeration (setting the address)
> host usually
> only retrieves some usb descriptors what doesn't change the state of the
> gadget.
> Right now we always reported 'disconnected' event before setting the new
> address,
> what is a bit overkill (in some cases gadget driver got this even more
> than once).
> The above code handles all cases correctly and reports disconnect event
> only once.

Well, if the disconnect happens before the SetAddress, the disconnect
won't be reported at all. Unless I'm reading the code wrong.

-- 
Paul



Re: [PATCH v3 0/9] PM / Domains: Fix race conditions during boot

2014-11-13 Thread Grygorii Strashko
On 11/13/2014 04:07 AM, Rafael J. Wysocki wrote:
> On Friday, November 07, 2014 07:25:08 PM Grygorii Strashko wrote:
> 
> [cut]
> 
>>
>> 4) I've copied here comment from Rafael:
>>    Of course, if ->probe() is to call pm_runtime_resume() for this 
>> purpose,
>>    it must take the fact that the driver's own ->runtime_resume() may be 
>> called
>>    as a result of this into account.
>>   Agree, that's a little bit annoying, but we are living with that for more 
>> then
>>   5 years already (I'm 3 years) - so, I am, as driver developer, expecting 
>> above behavior
>>   (just walk through the drivers and you will see how many drivers expecting 
>> the same).
>>
>> So, any volunteers to check and fix ~500 drivers.
> 
> Where did you get that number from?

Sry, my bad. Rechecked - found 289 occurrences of pm_runtime_enable().
Number of Runtime PM enabled drivers = at about 289 +-10%.
- headers, suspend/resume,..
+ buses like amba and spmi 

> 
> Also please note that some bus types don't have this problem by design (e.g. 
> PCI,
> as pointed to by Alan).

Right. I worry about Platform bus first of all, because HW PM implementation
(at least for ARM SoCs) can be very different there.

> 
> [cut]
> 
>>>

 - Runtime PM (if compiled in) needs to be enabled for all devices in power
 domains by default.  Otherwise devices may lose power as a result for
 power management of the other devices in the same domain.
>>
>> It should prevent enabling/disabling of RPM from sys_fs too.
> 
> It looks like you're confusing disable/enable with auto/on.  These are 
> different
> things.
> 

 - The core should try to power up domains before calling really_probe() 
 both
 for CONFIG_PM_RUNTIME set and unset, so ->probe() can always make the
 "device is accessible" assumption.
>>
>> Here I'm still think that pm_runtime_get_sync() (or similar) API should work.
>> Another way, PM domain should decide what to do when the first device 
>> attached to it
>> - power up and stay powered on for example
>>   (It will work if devices are attached before ->probe();
>>it will not work if devices will be attached once they've been created, 
>> but this is different
>>question)
> 
> The PM domain itself can't do that.  The only place that has enough knowledge
> is the code that enumerates devices (DT, ACPI or board-specific).
> 
>>>
>>> And how exactly will you then power up the PM domain when
>>> CONFIG_PM_RUNTIME is unset?
>>>

 - Bus types may need to do more on top of that in their ->probe(), so the
 driver's ->probe() can make that assumption too in all cases.

 Does that make sense to you?
>>>
>>
>> I would like to take the liberty to add a couple of points from me:
>>   - it seems reasonable to have ability to disable Runtime PM globally from 
>> sys_fs:
>> once disabled - "get" should power on device, "put" should do nothing 
>> all the
>> time except when ->remove() is called.
> 
> This is how the "power/control" file works and you can easily have this by 
> writing
> "on" to that file for every device.
> 
>>   
>>   - It might be reasonable to add API like pm_runtime_probe_getXXX() which 
>> will do
>> everything what standard pm_runtime_get_sync() is doing with one 
>> exception:
>> it will not call driver's .runtime_resume() callback.
> 
> Use case?

This is just a different view (RFC) on your idea to call pm_runtime_get_sync()
 before dev->driver is initialized
("(b) bypassing the driver callbacks somehow".
  http://marc.info/?l=linux-pm&m=141505768026211&w=2)

- add some flag like dev->is_probing
- in pm_runtime_probe_get_sync() do
  dev->is_probing = true;
  pm_runtime_get_sync();
  dev->is_probing = false;
  
- update 3 places in code pm_generic_runtime_resume, 
pm_genpd_default_save_state and
  __rpm_get_callback like below (only for .runtime_resume):

+++ b/drivers/base/power/generic_ops.c
@@ -42,6 +42,9 @@ int pm_generic_runtime_resume(struct device *dev)
 {
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
int ret;
+   
+   if (dev->is_probing)
+   pm = NULL;

Then drivers (at least platform drivers) will be able to call
  pm_runtime_enable(dev);
  pm_runtime_probe_get_sync(dev);
at any time they think is right (no problem with parent devices,
Power domain will be enabled, class/type/bus callback will be called,
no need to use pm_runtime_set_active()).

regards,
-grygorii

--
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 4/4 V3] ASoC: rt5631: Adding Device Tree compatibility to Realtek's ALC5631/RT5631 codec driver

2014-11-13 Thread Mark Brown
On Thu, Nov 13, 2014 at 05:44:24PM +0530, Krishna Mohan Dani wrote:
> Signed-off-by: Krishna Mohan Dani 

Applied, thanks.


signature.asc
Description: Digital signature


Re: [PATCH 3/4 V3] Sound: Kconfig: Adding the description of the codec

2014-11-13 Thread Mark Brown
On Thu, Nov 13, 2014 at 05:44:23PM +0530, Krishna Mohan Dani wrote:
> Signed-off-by: Krishna Mohan Dani 

Applied, please use subject lines matching the style for the subsystem.


signature.asc
Description: Digital signature


Re: [PATCH 1/4 V3] ASoC: ALC5631/RT5631: Add device tree binding documentation

2014-11-13 Thread Mark Brown
On Thu, Nov 13, 2014 at 05:44:21PM +0530, Krishna Mohan Dani wrote:
> Document the device tree binding for the ALC5631 codec and update vendor
> specific prefix for the Realtek.

Applied, thanks.


signature.asc
Description: Digital signature


[PATCH 2/7] ARM: Exynos: add support for sub-power domains

2014-11-13 Thread Andrzej Hajda
From: Marek Szyprowski 

This patch adds support for making one power domain a sub-domain of
other domain. This is useful for modeling power dependences for devices
like TV Mixer or Camera ISP, which needs to have more than one power
domain enabled to be operational.

Signed-off-by: Marek Szyprowski 
---
 Documentation/devicetree/bindings/arm/exynos/power_domain.txt | 2 ++
 arch/arm/mach-exynos/pm_domains.c | 9 -
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt 
b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
index abde1ea..cad9476 100644
--- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
+++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt
@@ -22,6 +22,8 @@ Optional Properties:
- pclkN, clkN: Pairs of parent of input clock and input clock to the
devices in this power domain. Maximum of 4 pairs (N = 0 to 3)
are supported currently.
+- power-domain-master: phandle to a master power domain that the given domain
+  is a part of
 
 Node of a device using power domains must have a samsung,power-domain property
 defined with a phandle to respective power domain.
diff --git a/arch/arm/mach-exynos/pm_domains.c 
b/arch/arm/mach-exynos/pm_domains.c
index 20f2671..373ac62 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -108,7 +108,7 @@ static int exynos_pd_power_off(struct generic_pm_domain 
*domain)
 static __init int exynos4_pm_init_power_domain(void)
 {
struct platform_device *pdev;
-   struct device_node *np;
+   struct device_node *np, *master_np;
 
for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") {
struct exynos_pm_domain *pd;
@@ -159,6 +159,13 @@ no_clk:
 
pm_genpd_init(&pd->pd, NULL, !on);
of_genpd_add_provider_simple(np, &pd->pd);
+
+   /* make master and slave hierarchy */
+   master_np = of_parse_phandle(np, "power-domain-master", 0);
+   if (master_np) {
+   pm_genpd_add_subdomain_names(master_np->name, np->name);
+   of_node_put(master_np);
+   }
}
 
return 0;
-- 
1.9.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 4/7] ARM: dts: exynos4: add dependency between TV and LCD0 power domains

2014-11-13 Thread Andrzej Hajda
From: Marek Szyprowski 

TV Mixer needs both TV and LCD0 domains enabled to be fully operational.
This dependency is modelled by making TV power domains a sub-domain of
LCD0 power domain.

Signed-off-by: Marek Szyprowski 
---
 arch/arm/boot/dts/exynos4.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 4ed5868..c728004 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -97,6 +97,7 @@
pd_tv: tv-power-domain@10023C20 {
compatible = "samsung,exynos4210-pd";
reg = <0x10023C20 0x20>;
+   power-domain-master = <&pd_lcd0>;
};
 
pd_cam: cam-power-domain@10023C00 {
-- 
1.9.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/7] ARM: dts: exynos4: add hdmi related nodes

2014-11-13 Thread Andrzej Hajda
From: Marek Szyprowski 

This patch adds entries for HDMI, Mixer and i2c with hdmi-phy modules
found in Exynos 4210 and 4x12 SoCs.

Signed-off-by: Marek Szyprowski 
---
 arch/arm/boot/dts/exynos4.dtsi| 40 +++
 arch/arm/boot/dts/exynos4210.dtsi |  8 
 arch/arm/boot/dts/exynos4x12.dtsi | 11 +++
 3 files changed, 59 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index e0278ec..4ed5868 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -38,6 +38,7 @@
i2c5 = &i2c_5;
i2c6 = &i2c_6;
i2c7 = &i2c_7;
+   i2c8 = &i2c_8;
csis0 = &csis_0;
csis1 = &csis_1;
fimc0 = &fimc_0;
@@ -537,6 +538,22 @@
status = "disabled";
};
 
+   i2c_8: i2c@138E {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "samsung,s3c2440-hdmiphy-i2c";
+   reg = <0x138E 0x100>;
+   interrupts = <0 93 0>;
+   clocks = <&clock CLK_I2C_HDMI>;
+   clock-names = "i2c";
+   status = "disabled";
+
+   hdmi_i2c_phy: hdmiphy@38 {
+   compatible = "exynos4210-hdmiphy";
+   reg = <0x38>;
+   };
+   };
+
spi_0: spi@1392 {
compatible = "samsung,exynos4210-spi";
reg = <0x1392 0x100>;
@@ -645,4 +662,27 @@
samsung,sysreg = <&sys_reg>;
status = "disabled";
};
+
+   hdmi: hdmi@12D0 {
+   compatible = "samsung,exynos4210-hdmi";
+   reg = <0x12D0 0x7>;
+   interrupts = <0 92 0>;
+   clock-names = "hdmi", "sclk_hdmi", "sclk_pixel", "sclk_hdmiphy",
+   "mout_hdmi";
+   clocks = <&clock CLK_HDMI>, <&clock CLK_SCLK_HDMI>,
+   <&clock CLK_SCLK_PIXEL>, <&clock CLK_SCLK_HDMIPHY>,
+   <&clock CLK_MOUT_HDMI>;
+   phy = <&hdmi_i2c_phy>;
+   samsung,power-domain = <&pd_tv>;
+   samsung,syscon-phandle = <&pmu_system_controller>;
+   status = "disabled";
+   };
+
+   mixer: mixer@12C1 {
+   compatible = "samsung,exynos4210-mixer";
+   interrupts = <0 91 0>;
+   reg = <0x12C1 0x2100>, <0x12c0 0x300>;
+   samsung,power-domain = <&pd_tv>;
+   status = "disabled";
+   };
 };
diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index 807bb5b..1c97784 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -175,4 +175,12 @@
samsung,lcd-wb;
};
};
+
+   mixer: mixer@12C1 {
+   clock-names = "mixer", "sclk_hdmi", "vp", "mout_mixer",
+   "sclk_mixer";
+   clocks = <&clock CLK_MIXER>, <&clock CLK_SCLK_HDMI>,
+   <&clock CLK_VP>, <&clock CLK_MOUT_MIXER>,
+   <&clock CLK_SCLK_MIXER>;
+   };
 };
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi 
b/arch/arm/boot/dts/exynos4x12.dtsi
index 861bb91..d6789a0 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -271,4 +271,15 @@
compatible = "samsung,exynos4x12-usb2-phy";
samsung,sysreg-phandle = <&sys_reg>;
};
+
+   hdmi: hdmi@12D0 {
+   compatible = "samsung,exynos4212-hdmi";
+   };
+
+   mixer: mixer@12C1 {
+   compatible = "samsung,exynos4212-mixer";
+   clock-names = "mixer", "sclk_hdmi", "vp";
+   clocks = <&clock CLK_MIXER>, <&clock CLK_SCLK_HDMI>,
+   <&clock CLK_VP>;
+   };
 };
-- 
1.9.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 5/7] ARM: dts: exynos4412-odroid: enable hdmi support

2014-11-13 Thread Andrzej Hajda
From: Marek Szyprowski 

This patch adds nodes specific to Exynos4412 based Odroid X/X2/U2/U3
boards required for enabling HDMI display.

Signed-off-by: Marek Szyprowski 
---
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 44 +
 1 file changed, 44 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi 
b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index c697ff0..4ebb557 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -205,6 +205,20 @@
regulator-always-on;
};
 
+   ldo8_reg: ldo@8 {
+   regulator-compatible = "LDO8";
+   regulator-name = "VDD10_HDMI_1.0V";
+   regulator-min-microvolt = <100>;
+   regulator-max-microvolt = <100>;
+   };
+
+   ldo10_reg: ldo@10 {
+   regulator-compatible = "LDO10";
+   regulator-name = "VDDQ_MIPIHSI_1.8V";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   };
+
ldo11_reg: LDO11 {
regulator-name = "VDD18_ABB1_1.8V";
regulator-min-microvolt = <180>;
@@ -363,6 +377,31 @@
ehci: ehci@1258 {
status = "okay";
};
+
+   mixer: mixer@12C1 {
+   status = "okay";
+   };
+
+   hdmi@12D0 {
+   hpd-gpio = <&gpx3 7 0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&hdmi_hpd>;
+   vdd-supply = <&ldo8_reg>;
+   vdd_osc-supply = <&ldo10_reg>;
+   vdd_pll-supply = <&ldo8_reg>;
+   ddc = <&hdmi_ddc>;
+   status = "okay";
+   };
+
+   hdmi_ddc: i2c@1388 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <&i2c2_bus>;
+   };
+
+   i2c@138E {
+   status = "okay";
+   };
 };
 
 &pinctrl_1 {
@@ -377,4 +416,9 @@
samsung,pin-pud = <0>;
samsung,pin-drv = <0>;
};
+
+   hdmi_hpd: hdmi-hpd {
+   samsung,pins = "gpx3-7";
+   samsung,pin-pud = <1>;
+   };
 };
-- 
1.9.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 1/7] clk: samsung: exynos4: set parent of mixer gate clock to hdmi

2014-11-13 Thread Andrzej Hajda
This dependency is not clearly documented, but it seems
mixer gate clock is not working without hdmi clock.
It causes system hangs during mixer access with disabled hdmi.

Signed-off-by: Andrzej Hajda 
---
 drivers/clk/samsung/clk-exynos4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk-exynos4.c 
b/drivers/clk/samsung/clk-exynos4.c
index 940f028..770a6d4 100644
--- a/drivers/clk/samsung/clk-exynos4.c
+++ b/drivers/clk/samsung/clk-exynos4.c
@@ -875,7 +875,7 @@ static struct samsung_gate_clock exynos4_gate_clks[] 
__initdata = {
GATE(CLK_SCLK_AUDIO1, "sclk_audio1", "div_audio1", SRC_MASK_PERIL1, 0,
CLK_SET_RATE_PARENT, 0),
GATE(CLK_VP, "vp", "aclk160", GATE_IP_TV, 0, 0, 0),
-   GATE(CLK_MIXER, "mixer", "aclk160", GATE_IP_TV, 1, 0, 0),
+   GATE(CLK_MIXER, "mixer", "hdmi", GATE_IP_TV, 1, 0, 0),
GATE(CLK_HDMI, "hdmi", "aclk160", GATE_IP_TV, 3, 0, 0),
GATE(CLK_PWM, "pwm", "aclk100", GATE_IP_PERIL, 24, 0, 0),
GATE(CLK_SDMMC4, "sdmmc4", "aclk133", GATE_IP_FSYS, 9, 0, 0),
-- 
1.9.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 0/7] Enable HDMI support on Exynos platforms

2014-11-13 Thread Andrzej Hajda
This set of patches enables HDMI support for two Exynos based platforms:
UniversalC210 and Odroid.
Beside DTS changes patchset adds parent domain support for Exynos PM domains
and small but critical change in mixer clock. For details see individual 
patches.

The patchset is based on v3.18-rc4.

Regards
Andrzej


Andrzej Hajda (2):
  clk: samsung: exynos4: set parent of mixer gate clock to hdmi
  ARM: dts: exynos5250: add display power domain

Marek Szyprowski (4):
  ARM: Exynos: add support for sub-power domains
  ARM: dts: exynos4: add hdmi related nodes
  ARM: dts: exynos4: add dependency between TV and LCD0 power domains
  ARM: dts: exynos4412-odroid: enable hdmi support

Tomasz Stanislawski (1):
  ARM: dts: exynos4210-universal_c210: enable hdmi support

 .../bindings/arm/exynos/power_domain.txt   |  2 +
 arch/arm/boot/dts/exynos4.dtsi | 41 
 arch/arm/boot/dts/exynos4210-universal_c210.dts| 57 ++
 arch/arm/boot/dts/exynos4210.dtsi  |  8 +++
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi| 44 +
 arch/arm/boot/dts/exynos4x12.dtsi  | 11 +
 arch/arm/boot/dts/exynos5250.dtsi  |  9 
 arch/arm/mach-exynos/pm_domains.c  |  9 +++-
 drivers/clk/samsung/clk-exynos4.c  |  2 +-
 9 files changed, 181 insertions(+), 2 deletions(-)

-- 
1.9.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 v3 1/2] usb: dwc2/gadget: add mutex to serialize init/deinit calls

2014-11-13 Thread Marek Szyprowski

Hello,

On 2014-10-31 19:46, Paul Zimmerman wrote:

From: Marek Szyprowski [mailto:m.szyprow...@samsung.com]
Sent: Friday, October 31, 2014 3:13 AM

This patch adds mutex, which protects initialization and
deinitialization procedures against suspend/resume methods.

Signed-off-by: Marek Szyprowski 
---
  drivers/usb/dwc2/core.h   |  1 +
  drivers/usb/dwc2/gadget.c | 20 
  2 files changed, 21 insertions(+)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 9f77b4d1c5ff..58732a9a0019 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -187,6 +187,7 @@ struct s3c_hsotg {
struct s3c_hsotg_plat*plat;

spinlock_t  lock;
+   struct mutexinit_mutex;

void __iomem*regs;
int irq;
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index d8dda39c9e16..a2e4272a904e 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -21,6 +21,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -2908,6 +2909,7 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
return -EINVAL;
}

+   mutex_lock(&hsotg->init_mutex);
WARN_ON(hsotg->driver);

driver->driver.bus = NULL;
@@ -2933,9 +2935,12 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,

dev_info(hsotg->dev, "bound driver %s\n", driver->driver.name);

+   mutex_unlock(&hsotg->init_mutex);
+
return 0;

  err:
+   mutex_unlock(&hsotg->init_mutex);
hsotg->driver = NULL;
return ret;
  }
@@ -2957,6 +2962,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,
if (!hsotg)
return -ENODEV;

+   mutex_lock(&hsotg->init_mutex);
+
/* all endpoints should be shutdown */
for (ep = 1; ep < hsotg->num_of_eps; ep++)
s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
@@ -2974,6 +2981,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget,

clk_disable(hsotg->clk);

+   mutex_unlock(&hsotg->init_mutex);
+
return 0;
  }

@@ -3002,6 +3011,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, 
int is_on)

dev_dbg(hsotg->dev, "%s: is_on: %d\n", __func__, is_on);

+   mutex_lock(&hsotg->init_mutex);
spin_lock_irqsave(&hsotg->lock, flags);
if (is_on) {
clk_enable(hsotg->clk);
@@ -3013,6 +3023,7 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, 
int is_on)

hsotg->gadget.speed = USB_SPEED_UNKNOWN;
spin_unlock_irqrestore(&hsotg->lock, flags);
+   mutex_unlock(&hsotg->init_mutex);

return 0;
  }
@@ -3507,6 +3518,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
}

spin_lock_init(&hsotg->lock);
+   mutex_init(&hsotg->init_mutex);

hsotg->irq = ret;

@@ -3652,6 +3664,8 @@ static int s3c_hsotg_suspend(struct platform_device 
*pdev, pm_message_t state)
unsigned long flags;
int ret = 0;

+   mutex_lock(&hsotg->init_mutex);
+
if (hsotg->driver)
dev_info(hsotg->dev, "suspending usb gadget %s\n",
 hsotg->driver->driver.name);
@@ -3674,6 +3688,8 @@ static int s3c_hsotg_suspend(struct platform_device 
*pdev, pm_message_t state)
clk_disable(hsotg->clk);
}

+   mutex_unlock(&hsotg->init_mutex);
+
return ret;
  }

@@ -3683,7 +3699,9 @@ static int s3c_hsotg_resume(struct platform_device *pdev)
unsigned long flags;
int ret = 0;

+   mutex_lock(&hsotg->init_mutex);
if (hsotg->driver) {
+
dev_info(hsotg->dev, "resuming usb gadget %s\n",
 hsotg->driver->driver.name);

@@ -3699,6 +3717,8 @@ static int s3c_hsotg_resume(struct platform_device *pdev)
s3c_hsotg_core_connect(hsotg);
spin_unlock_irqrestore(&hsotg->lock, flags);

+   mutex_unlock(&hsotg->init_mutex);
+
return ret;
  }


Hmm. I can't find any other UDC driver that uses a mutex in its
suspend/resume functions. Can you explain why this is needed only
for dwc2?


I've posted this version because I thought you were not convinced that 
the patch
"usb: dwc2/gadget: rework suspend/resume code to correctly restore 
gadget state"
can add code for initialization and deinitialization in suspend/resume 
paths.


Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
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] thermal: exynos: use correct offset for TMU_CONTROL register on Exynos5260

2014-11-13 Thread Bartlomiej Zolnierkiewicz

Hi,

On Friday, November 07, 2014 02:59:51 PM Eduardo Valentin wrote:
> Hi Bartlomiej,
> 
> On Mon, Oct 20, 2014 at 02:41:07PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > 
> > Hi,
> > 
> > Eduardo, could you please merge this patch?
> > 
> 
> I queued this in my -fixes branch. It should appear also in linux-next.

Thanks!

> Can you please refresh your patch series
> https://lkml.org/lkml/2014/9/18/305
> 
> based on my tree? Looks like something may be missing, as could not get
> all patches applied cleanly.

Done:

  http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg38717.html

Sorry for the delay.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> Thanks
> 
> > Best regards,
> > --
> > Bartlomiej Zolnierkiewicz
> > Samsung R&D Institute Poland
> > Samsung Electronics
> > 
> > On Thursday, September 11, 2014 03:00:49 PM Bartlomiej Zolnierkiewicz wrote:
> > > In exynos5260_tmu_registers tmu_ctrl entry is erroneously
> > > assigned twice.  The second assignment (to EXYNOS_TMU_REG_CONTROL1
> > > define which represents 0x24 value) overrides the first one
> > > (to EXYNOS_TMU_REG_CONTROL define which represents 0x20 value)
> > > which results in the wrong (according to the Exynos5260 SoC
> > > documentation that I have) offset being used for TMU_CONTROL
> > > register.  Fix it by removing the wrong assignment and then
> > > remove no longer used EXYNOS_TMU_REG_CONTROL1 define.
> > > 
> > > Cc: Naveen Krishna Chatradhi 
> > > Cc: Amit Daniel Kachhap 
> > > Cc: Lukasz Majewski 
> > > Cc: Eduardo Valentin 
> > > Cc: Zhang Rui 
> > > Signed-off-by: Bartlomiej Zolnierkiewicz 
> > > Acked-by: Kyungmin Park 
> > > ---
> > >  drivers/thermal/samsung/exynos_tmu_data.c |1 -
> > >  drivers/thermal/samsung/exynos_tmu_data.h |1 -
> > >  2 files changed, 2 deletions(-)
> > > 
> > > Index: b/drivers/thermal/samsung/exynos_tmu_data.c
> > > ===
> > > --- a/drivers/thermal/samsung/exynos_tmu_data.c   2014-09-11 
> > > 14:41:12.567347442 +0200
> > > +++ b/drivers/thermal/samsung/exynos_tmu_data.c   2014-09-11 
> > > 14:43:00.211350284 +0200
> > > @@ -273,7 +273,6 @@ struct exynos_tmu_init_data const exynos
> > >  static const struct exynos_tmu_registers exynos5260_tmu_registers = {
> > >   .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
> > >   .tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
> > > - .tmu_ctrl = EXYNOS_TMU_REG_CONTROL1,
> > >   .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
> > >   .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
> > >   .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
> > > Index: b/drivers/thermal/samsung/exynos_tmu_data.h
> > > ===
> > > --- a/drivers/thermal/samsung/exynos_tmu_data.h   2014-09-11 
> > > 14:41:12.243347433 +0200
> > > +++ b/drivers/thermal/samsung/exynos_tmu_data.h   2014-09-11 
> > > 14:43:36.167351233 +0200
> > > @@ -83,7 +83,6 @@
> > >  #define EXYNOS_MAX_TRIGGER_PER_REG   4
> > >  
> > >  /* Exynos5260 specific */
> > > -#define EXYNOS_TMU_REG_CONTROL1  0x24
> > >  #define EXYNOS5260_TMU_REG_INTEN 0xC0
> > >  #define EXYNOS5260_TMU_REG_INTSTAT   0xC4
> > >  #define EXYNOS5260_TMU_REG_INTCLEAR  0xC8

--
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 v2 07/33] thermal: exynos: remove needless therm_trip_en_shift abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->therm_trip_en_shift is used only in exynos_tmu_initialize()
and not accessed on Exynos4210 (also reg->therm_trip_en_shift is
not even assigned in exynos4210_tmu_registers but it is assigned
to identical value for all other SoC types) so the register
abstraction is not needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 2 +-
 drivers/thermal/samsung/exynos_tmu.h  | 2 --
 drivers/thermal/samsung/exynos_tmu_data.c | 5 -
 3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index fb38411..3f3b8cf 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -266,7 +266,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
data->base + reg->threshold_th2);
}
con = readl(data->base + reg->tmu_ctrl);
-   con |= (1 << reg->therm_trip_en_shift);
+   con |= (1 << EXYNOS_TMU_THERM_TRIP_EN_SHIFT);
writel(con, data->base + reg->tmu_ctrl);
}
}
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 88c16d7..4798313 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -77,7 +77,6 @@ enum soc_type {
  * bitfields. The register validity, offsets and bitfield values may vary
  * slightly across different exynos SOC's.
  * @tmu_ctrl: TMU main controller register.
- * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register.
  * @tmu_cur_temp: register containing the current temperature of the TMU.
  * @threshold_th0: Register containing first set of rising levels.
  * @threshold_th1: Register containing second set of rising levels.
@@ -100,7 +99,6 @@ enum soc_type {
  */
 struct exynos_tmu_registers {
u32 tmu_ctrl;
-   u32 therm_trip_en_shift;
 
u32 tmu_cur_temp;
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 4a44eb7..a120a8c 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -83,7 +83,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
 #if defined(CONFIG_SOC_EXYNOS3250)
 static const struct exynos_tmu_registers exynos3250_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -156,7 +155,6 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
 static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -242,7 +240,6 @@ struct exynos_tmu_init_data const 
exynos5250_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS5260)
 static const struct exynos_tmu_registers exynos5260_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -317,7 +314,6 @@ struct exynos_tmu_init_data const 
exynos5260_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS5420)
 static const struct exynos_tmu_registers exynos5420_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -400,7 +396,6 @@ struct exynos_tmu_init_data const 
exynos5420_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS5440)
 static const struct exynos_tmu_registers exynos5440_tmu_registers = {
.tmu_ctrl = EXYNOS5440_TMU_S0_7_CTRL,
-   .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP,
.threshold_th0 = EXYNOS5440_TMU_S0_7_TH0,
.threshold_th1 = EXYNOS5440_TMU_S0_7_TH1,
-- 
1.8.2.3

--
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 v2 04/33] thermal: exynos: remove needless triminfo_ctrl abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->triminfo_ctrl[] is used in only exynos_tmu_initialize() and
accessed only if TMU_SUPPORT_TRIM_RELOAD flag is set.  This flag
is set only on Exynos3250, Exynos4412 and Exynos5250 (other SoC
types don't even have triminfo_ctrl[] entries assigned in their
struct exynos_tmu_registers instances) so the register abstraction
is not needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_thermal_common.h |  1 -
 drivers/thermal/samsung/exynos_tmu.c| 15 +++
 drivers/thermal/samsung/exynos_tmu.h|  7 ---
 drivers/thermal/samsung/exynos_tmu_data.c   |  8 
 4 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_thermal_common.h 
b/drivers/thermal/samsung/exynos_thermal_common.h
index 158f5aa..cd44719 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.h
+++ b/drivers/thermal/samsung/exynos_thermal_common.h
@@ -27,7 +27,6 @@
 #define SENSOR_NAME_LEN16
 #define MAX_TRIP_COUNT 8
 #define MAX_COOLING_DEVICE 4
-#define MAX_TRIMINFO_CTRL_REG  2
 
 #define ACTIVE_INTERVAL 500
 #define IDLE_INTERVAL 1
diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 12e6f16..160e7fa 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -162,15 +162,14 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
}
 
if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) {
-   for (i = 0; i < reg->triminfo_ctrl_count; i++) {
-   if (pdata->triminfo_reload[i]) {
-   ctrl = readl(data->base +
-   reg->triminfo_ctrl[i]);
-   ctrl |= pdata->triminfo_reload[i];
-   writel(ctrl, data->base +
-   reg->triminfo_ctrl[i]);
-   }
+   if (data->soc == SOC_ARCH_EXYNOS3250) {
+   ctrl = readl(data->base + EXYNOS_TMU_TRIMINFO_CON1);
+   ctrl |= EXYNOS_TRIMINFO_RELOAD_ENABLE;
+   writel(ctrl, data->base + EXYNOS_TMU_TRIMINFO_CON1);
}
+   ctrl = readl(data->base + EXYNOS_TMU_TRIMINFO_CON2);
+   ctrl |= EXYNOS_TRIMINFO_RELOAD_ENABLE;
+   writel(ctrl, data->base + EXYNOS_TMU_TRIMINFO_CON2);
}
 
/* Save trimming info in order to perform calibration */
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index d693215..cee81a1 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -76,8 +76,6 @@ enum soc_type {
  * struct exynos_tmu_register - register descriptors to access registers and
  * bitfields. The register validity, offsets and bitfield values may vary
  * slightly across different exynos SOC's.
- * @triminfo_ctrl: trim info controller register.
- * @triminfo_ctrl_count: the number of trim info controller register.
  * @tmu_ctrl: TMU main controller register.
  * @test_mux_addr_shift: shift bits of test mux address.
  * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
@@ -104,9 +102,6 @@ enum soc_type {
  * @tmu_pmin: register to get/set the Pmin value.
  */
 struct exynos_tmu_registers {
-   u32 triminfo_ctrl[MAX_TRIMINFO_CTRL_REG];
-   u32 triminfo_ctrl_count;
-
u32 tmu_ctrl;
u32 test_mux_addr_shift;
u32 therm_trip_mode_shift;
@@ -184,7 +179,6 @@ struct exynos_tmu_registers {
  * @second_point_trim: temp value of the second point trimming
  * @default_temp_offset: default temperature offset in case of no trimming
  * @test_mux; information if SoC supports test MUX
- * @triminfo_reload: reload value to read TRIMINFO register
  * @cal_type: calibration type for temperature
  * @freq_clip_table: Table representing frequency reduction percentage.
  * @freq_tab_count: Count of the above table as frequency reduction may
@@ -215,7 +209,6 @@ struct exynos_tmu_platform_data {
u8 second_point_trim;
u8 default_temp_offset;
u8 test_mux;
-   u8 triminfo_reload[MAX_TRIMINFO_CTRL_REG];
 
enum calibration_type cal_type;
enum soc_type type;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 8153c41..d4b9a68 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -82,9 +82,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
 
 #if defined(CONFIG_SOC_EXYNOS3250)
 static const struct exynos_tmu_registers exynos3250_tmu_registers = {
-   .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO

[PATCH v2 08/33] thermal: exynos: remove needless emul_temp_shift abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->emul_temp_shift is used only in exynos_tmu_set_emulation()
and accessed only if TMU_SUPPORT_EMULATION flag is set.  This
flag is not set for Exynos4210 (reg->emul_temp_shift field is
not even assigned in exynos4210_tmu_registers and is assigned
to identical value for all other SoC types) so the abstraction
is not needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 4 ++--
 drivers/thermal/samsung/exynos_tmu.h  | 2 --
 drivers/thermal/samsung/exynos_tmu_data.c | 5 -
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 3f3b8cf..c108a1f 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -383,8 +383,8 @@ static int exynos_tmu_set_emulation(void *drv_data, 
unsigned long temp)
val &= ~(EXYNOS_EMUL_TIME_MASK << reg->emul_time_shift);
val |= (EXYNOS_EMUL_TIME << reg->emul_time_shift);
}
-   val &= ~(EXYNOS_EMUL_DATA_MASK << reg->emul_temp_shift);
-   val |= (temp_to_code(data, temp) << reg->emul_temp_shift) |
+   val &= ~(EXYNOS_EMUL_DATA_MASK << EXYNOS_EMUL_DATA_SHIFT);
+   val |= (temp_to_code(data, temp) << EXYNOS_EMUL_DATA_SHIFT) |
EXYNOS_EMUL_ENABLE;
} else {
val &= ~EXYNOS_EMUL_ENABLE;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 4798313..ed3d816 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -92,7 +92,6 @@ enum soc_type {
  * @tmu_intstat: Register containing the interrupt status values.
  * @tmu_intclear: Register for clearing the raised interrupt status.
  * @emul_con: TMU emulation controller register.
- * @emul_temp_shift: shift bits of emulation temperature.
  * @emul_time_shift: shift bits of emulation time.
  * @tmu_irqstatus: register to find which TMU generated interrupts.
  * @tmu_pmin: register to get/set the Pmin value.
@@ -119,7 +118,6 @@ struct exynos_tmu_registers {
u32 tmu_intclear;
 
u32 emul_con;
-   u32 emul_temp_shift;
u32 emul_time_shift;
 
u32 tmu_irqstatus;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index a120a8c..c35a6ea 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -94,7 +94,6 @@ static const struct exynos_tmu_registers 
exynos3250_tmu_registers = {
.tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
.emul_con = EXYNOS_EMUL_CON,
-   .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
.emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
@@ -167,7 +166,6 @@ static const struct exynos_tmu_registers 
exynos4412_tmu_registers = {
.tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
.emul_con = EXYNOS_EMUL_CON,
-   .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
.emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
@@ -252,7 +250,6 @@ static const struct exynos_tmu_registers 
exynos5260_tmu_registers = {
.tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR,
.emul_con = EXYNOS5260_EMUL_CON,
-   .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
.emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
@@ -327,7 +324,6 @@ static const struct exynos_tmu_registers 
exynos5420_tmu_registers = {
.tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
.emul_con = EXYNOS_EMUL_CON,
-   .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
.emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
@@ -411,7 +407,6 @@ static const struct exynos_tmu_registers 
exynos5440_tmu_registers = {
.tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ,
.tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS,
.emul_con = EXYNOS5440_TMU_S0_7_DEBUG,
-   .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT,
.tmu_pmin = EXYNOS5440_TMU_PMIN,
 };
 
-- 
1.8.2.3

--
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 v2 05/33] thermal: exynos: remove needless test_mux_addr_shift abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->test_mux_addr_shift is used only if pdata->test_mux is
non-zero.  pdata->test_mux is defined only on Exynos3250 and
Exynos4412 (other SoC types don't even have pdata->test_mux
entry assigned in their struct exynos_tmu_registers instances)
so the abstraction is not needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 2 +-
 drivers/thermal/samsung/exynos_tmu.h  | 2 --
 drivers/thermal/samsung/exynos_tmu_data.c | 2 --
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 160e7fa..c8d6cdde 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -295,7 +295,7 @@ static void exynos_tmu_control(struct platform_device 
*pdev, bool on)
con = readl(data->base + reg->tmu_ctrl);
 
if (pdata->test_mux)
-   con |= (pdata->test_mux << reg->test_mux_addr_shift);
+   con |= (pdata->test_mux << EXYNOS4412_MUX_ADDR_SHIFT);
 
con &= ~(EXYNOS_TMU_REF_VOLTAGE_MASK << EXYNOS_TMU_REF_VOLTAGE_SHIFT);
con |= pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index cee81a1..0fb10d1 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -77,7 +77,6 @@ enum soc_type {
  * bitfields. The register validity, offsets and bitfield values may vary
  * slightly across different exynos SOC's.
  * @tmu_ctrl: TMU main controller register.
- * @test_mux_addr_shift: shift bits of test mux address.
  * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
  * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register.
  * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register.
@@ -103,7 +102,6 @@ enum soc_type {
  */
 struct exynos_tmu_registers {
u32 tmu_ctrl;
-   u32 test_mux_addr_shift;
u32 therm_trip_mode_shift;
u32 therm_trip_mode_mask;
u32 therm_trip_en_shift;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index d4b9a68..4ca1283 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -83,7 +83,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
 #if defined(CONFIG_SOC_EXYNOS3250)
 static const struct exynos_tmu_registers exynos3250_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
@@ -159,7 +158,6 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
 static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT,
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
-- 
1.8.2.3

--
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 v2 06/33] thermal: exynos: remove needless therm_trip_[mode,mask]_shift abstractions

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->therm_trip_mode_shift and reg->therm_trip_mode_mask are
used only in exynos_tmu_control() and accessed only if
pdata->noise_cancel_mode is non-zero.  pdata->noise_cancel
field is not defined on Exynos4210 (also therm_trip_mode_shift
and therm_trip_mode_mask entries are not even assigned in
exynos4210_tmu_registers but they are assigned to identical
values for all other SoC types) so the abstractions are not
needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  |  5 ++---
 drivers/thermal/samsung/exynos_tmu.h  |  4 
 drivers/thermal/samsung/exynos_tmu_data.c | 10 --
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index c8d6cdde..fb38411 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -304,9 +304,8 @@ static void exynos_tmu_control(struct platform_device 
*pdev, bool on)
con |= (pdata->gain << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT);
 
if (pdata->noise_cancel_mode) {
-   con &= ~(reg->therm_trip_mode_mask <<
-   reg->therm_trip_mode_shift);
-   con |= (pdata->noise_cancel_mode << reg->therm_trip_mode_shift);
+   con &= ~(EXYNOS_TMU_TRIP_MODE_MASK << 
EXYNOS_TMU_TRIP_MODE_SHIFT);
+   con |= (pdata->noise_cancel_mode << EXYNOS_TMU_TRIP_MODE_SHIFT);
}
 
if (on) {
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 0fb10d1..88c16d7 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -77,8 +77,6 @@ enum soc_type {
  * bitfields. The register validity, offsets and bitfield values may vary
  * slightly across different exynos SOC's.
  * @tmu_ctrl: TMU main controller register.
- * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
- * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register.
  * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register.
  * @tmu_cur_temp: register containing the current temperature of the TMU.
  * @threshold_th0: Register containing first set of rising levels.
@@ -102,8 +100,6 @@ enum soc_type {
  */
 struct exynos_tmu_registers {
u32 tmu_ctrl;
-   u32 therm_trip_mode_shift;
-   u32 therm_trip_mode_mask;
u32 therm_trip_en_shift;
 
u32 tmu_cur_temp;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 4ca1283..4a44eb7 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -83,8 +83,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
 #if defined(CONFIG_SOC_EXYNOS3250)
 static const struct exynos_tmu_registers exynos3250_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
-   .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
@@ -158,8 +156,6 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
 static const struct exynos_tmu_registers exynos4412_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
-   .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
@@ -246,8 +242,6 @@ struct exynos_tmu_init_data const 
exynos5250_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS5260)
 static const struct exynos_tmu_registers exynos5260_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
-   .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
@@ -323,8 +317,6 @@ struct exynos_tmu_init_data const 
exynos5260_default_tmu_data = {
 #if defined(CONFIG_SOC_EXYNOS5420)
 static const struct exynos_tmu_registers exynos5420_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
-   .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
 

[PATCH v2 01/33] thermal: exynos: remove needless triminfo_data abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->triminfo_data is used only in exynos_tmu_initialize() and
the code has already different paths for Exynos5440 and other
SoC types (on which TRIMINFO_DATA register offset is identical)
so the register abstraction is not needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 10 +-
 drivers/thermal/samsung/exynos_tmu.h  |  3 ---
 drivers/thermal/samsung/exynos_tmu_data.c |  6 --
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 49c0924..bb05355 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -182,22 +182,22 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
switch (data->id) {
case 0:
trim_info = readl(data->base +
-   EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data);
+   EXYNOS5440_EFUSE_SWAP_OFFSET + 
EXYNOS5440_TMU_S0_7_TRIM);
break;
case 1:
-   trim_info = readl(data->base + reg->triminfo_data);
+   trim_info = readl(data->base + 
EXYNOS5440_TMU_S0_7_TRIM);
break;
case 2:
trim_info = readl(data->base -
-   EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data);
+   EXYNOS5440_EFUSE_SWAP_OFFSET + 
EXYNOS5440_TMU_S0_7_TRIM);
}
} else {
/* On exynos5420 the triminfo register is in the shared space */
if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
trim_info = readl(data->base_second +
-   reg->triminfo_data);
+   EXYNOS_TMU_REG_TRIMINFO);
else
-   trim_info = readl(data->base + reg->triminfo_data);
+   trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
}
data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) &
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index c58c766..91e2317 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -76,7 +76,6 @@ enum soc_type {
  * struct exynos_tmu_register - register descriptors to access registers and
  * bitfields. The register validity, offsets and bitfield values may vary
  * slightly across different exynos SOC's.
- * @triminfo_data: register containing 2 pont trimming data
  * @triminfo_ctrl: trim info controller register.
  * @triminfo_ctrl_count: the number of trim info controller register.
  * @tmu_ctrl: TMU main controller register.
@@ -107,8 +106,6 @@ enum soc_type {
  * @tmu_pmin: register to get/set the Pmin value.
  */
 struct exynos_tmu_registers {
-   u32 triminfo_data;
-
u32 triminfo_ctrl[MAX_TRIMINFO_CTRL_REG];
u32 triminfo_ctrl_count;
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 1724f6c..a6088ff 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -26,7 +26,6 @@
 
 #if defined(CONFIG_CPU_EXYNOS4210)
 static const struct exynos_tmu_registers exynos4210_tmu_registers = {
-   .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
.tmu_status = EXYNOS_TMU_REG_STATUS,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
@@ -85,7 +84,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
 
 #if defined(CONFIG_SOC_EXYNOS3250)
 static const struct exynos_tmu_registers exynos3250_tmu_registers = {
-   .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
.triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON1,
.triminfo_ctrl[1] = EXYNOS_TMU_TRIMINFO_CON2,
.triminfo_ctrl_count = 2,
@@ -168,7 +166,6 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
 
 #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
 static const struct exynos_tmu_registers exynos4412_tmu_registers = {
-   .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
.triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON2,
.triminfo_ctrl_count = 1,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
@@ -262,7 +259,6 @@ struct exynos_tmu_init_data const 
exynos5250_default_tmu_data = {
 
 #if defined(CONFIG_SOC_EXYNOS5260)
 static const struct exynos_tmu_registers exynos5260_tmu_registers = {
-   .triminfo_data = EXYNOS_TMU_REG_TRIMINFO,
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
 

[PATCH v2 03/33] thermal: exynos: remove needless threshold_temp abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->threshold_temp is used only in exynos_tmu_initialize() and
is accessed only on Exynos4210 (other SoC types don't even have
threshold_temp entry assigned in their struct exynos_tmu_registers
instances) so the register abstraction is not needed and can be
removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 2 +-
 drivers/thermal/samsung/exynos_tmu.h  | 3 ---
 drivers/thermal/samsung/exynos_tmu_data.c | 1 -
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index ac43637..12e6f16 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -219,7 +219,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
/* Write temperature code for threshold */
threshold_code = temp_to_code(data, pdata->threshold);
writeb(threshold_code,
-   data->base + reg->threshold_temp);
+   data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP);
for (i = 0; i < pdata->non_hw_trigger_levels; i++)
writeb(pdata->trigger_levels[i], data->base +
reg->threshold_th0 + i * sizeof(reg->threshold_th0));
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 7849d8f..d693215 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -84,7 +84,6 @@ enum soc_type {
  * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register.
  * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register.
  * @tmu_cur_temp: register containing the current temperature of the TMU.
- * @threshold_temp: register containing the base threshold level.
  * @threshold_th0: Register containing first set of rising levels.
  * @threshold_th1: Register containing second set of rising levels.
  * @threshold_th2: Register containing third set of rising levels.
@@ -116,8 +115,6 @@ struct exynos_tmu_registers {
 
u32 tmu_cur_temp;
 
-   u32 threshold_temp;
-
u32 threshold_th0;
u32 threshold_th1;
u32 threshold_th2;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 49c8142..8153c41 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -28,7 +28,6 @@
 static const struct exynos_tmu_registers exynos4210_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
-   .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP,
.threshold_th0 = EXYNOS4210_TMU_REG_TRIG_LEVEL0,
.tmu_inten = EXYNOS_TMU_REG_INTEN,
.inten_rise0_shift = EXYNOS_TMU_INTEN_RISE0_SHIFT,
-- 
1.8.2.3

--
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 v2 10/33] thermal: exynos: replace tmu_irqstatus check by Exynos5440 one

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->tmu_irqstatus is set to non-zero value only for Exynos5440
so replace check for non-zero value of reg->tmu_irqstatus by
explicitly checking for Exynos5440 SoC type.  Then remove no
longer needed reg->tmu_irqstatus register abstraction.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 6 ++
 drivers/thermal/samsung/exynos_tmu.h  | 2 --
 drivers/thermal/samsung/exynos_tmu_data.c | 1 -
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index e35c289..839b07b 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -407,15 +407,13 @@ static void exynos_tmu_work(struct work_struct *work)
 {
struct exynos_tmu_data *data = container_of(work,
struct exynos_tmu_data, irq_work);
-   struct exynos_tmu_platform_data *pdata = data->pdata;
-   const struct exynos_tmu_registers *reg = pdata->registers;
unsigned int val_type;
 
if (!IS_ERR(data->clk_sec))
clk_enable(data->clk_sec);
/* Find which sensor generated this interrupt */
-   if (reg->tmu_irqstatus) {
-   val_type = readl(data->base_second + reg->tmu_irqstatus);
+   if (data->soc == SOC_ARCH_EXYNOS5440) {
+   val_type = readl(data->base_second + EXYNOS5440_TMU_IRQ_STATUS);
if (!((val_type >> data->id) & 0x1))
goto out;
}
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 2694298..5c2cef1 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -92,7 +92,6 @@ enum soc_type {
  * @tmu_intstat: Register containing the interrupt status values.
  * @tmu_intclear: Register for clearing the raised interrupt status.
  * @emul_con: TMU emulation controller register.
- * @tmu_irqstatus: register to find which TMU generated interrupts.
  * @tmu_pmin: register to get/set the Pmin value.
  */
 struct exynos_tmu_registers {
@@ -118,7 +117,6 @@ struct exynos_tmu_registers {
 
u32 emul_con;
 
-   u32 tmu_irqstatus;
u32 tmu_pmin;
 };
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index cef0b97..557b4a5 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -401,7 +401,6 @@ static const struct exynos_tmu_registers 
exynos5440_tmu_registers = {
.inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT,
.tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ,
.tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ,
-   .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS,
.emul_con = EXYNOS5440_TMU_S0_7_DEBUG,
.tmu_pmin = EXYNOS5440_TMU_PMIN,
 };
-- 
1.8.2.3

--
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 v2 11/33] thermal: exynos: replace tmu_pmin check by Exynos5440 one

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->tmu_pmin is set to non-zero value only for Exynos5440
so replace check for non-zero value of reg->tmu_pmin by
explicitly checking for Exynos5440 SoC type.  Then remove no
longer needed reg->tmu_pmin register abstraction.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 4 ++--
 drivers/thermal/samsung/exynos_tmu.h  | 3 ---
 drivers/thermal/samsung/exynos_tmu_data.c | 1 -
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 839b07b..411c465 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -271,8 +271,8 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
}
}
/*Clear the PMIN in the common TMU register*/
-   if (reg->tmu_pmin && !data->id)
-   writel(0, data->base_second + reg->tmu_pmin);
+   if (data->soc == SOC_ARCH_EXYNOS5440 && !data->id)
+   writel(0, data->base_second + EXYNOS5440_TMU_PMIN);
 out:
clk_disable(data->clk);
mutex_unlock(&data->lock);
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 5c2cef1..e8510aa 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -92,7 +92,6 @@ enum soc_type {
  * @tmu_intstat: Register containing the interrupt status values.
  * @tmu_intclear: Register for clearing the raised interrupt status.
  * @emul_con: TMU emulation controller register.
- * @tmu_pmin: register to get/set the Pmin value.
  */
 struct exynos_tmu_registers {
u32 tmu_ctrl;
@@ -116,8 +115,6 @@ struct exynos_tmu_registers {
u32 tmu_intclear;
 
u32 emul_con;
-
-   u32 tmu_pmin;
 };
 
 /**
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 557b4a5..fe063d4 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -402,7 +402,6 @@ static const struct exynos_tmu_registers 
exynos5440_tmu_registers = {
.tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ,
.tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ,
.emul_con = EXYNOS5440_TMU_S0_7_DEBUG,
-   .tmu_pmin = EXYNOS5440_TMU_PMIN,
 };
 
 #define EXYNOS5440_TMU_DATA \
-- 
1.8.2.3

--
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 v2 14/33] thermal: exynos: remove TMU_SUPPORT_READY_STATUS flag

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace TMU_SUPPORT_READY_STATUS flag check in
exynos_tmu_initialize() by an explicit check for a SoC type
(all SoC types except Exynos5440 have TMU_SUPPORT_READY_STATUS
flag set in their struct exynos_tmu_init_data instances).

This is a preparation for introducing per-SoC type tmu_initialize
method.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  |  2 +-
 drivers/thermal/samsung/exynos_tmu.h  |  7 ++-
 drivers/thermal/samsung/exynos_tmu_data.c | 14 +-
 3 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 4f7cad9..33ee527 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -153,7 +153,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
if (!IS_ERR(data->clk_sec))
clk_enable(data->clk_sec);
 
-   if (TMU_SUPPORTS(pdata, READY_STATUS)) {
+   if (data->soc != SOC_ARCH_EXYNOS5440) {
status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status) {
ret = -EBUSY;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index ebe39b4..d3d9205 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -54,8 +54,6 @@ enum soc_type {
  * be reloaded.
  * TMU_SUPPORT_FALLING_TRIP - This features shows that interrupt can
  * be registered for falling trips also.
- * TMU_SUPPORT_READY_STATUS - This feature tells that the TMU current
- * state(active/idle) can be checked.
  * TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation
  * sample time.
  * TMU_SUPPORT_ADDRESS_MULTIPLE - This feature tells that the different TMU
@@ -66,9 +64,8 @@ enum soc_type {
 #define TMU_SUPPORT_MULTI_INST BIT(1)
 #define TMU_SUPPORT_TRIM_RELOADBIT(2)
 #define TMU_SUPPORT_FALLING_TRIP   BIT(3)
-#define TMU_SUPPORT_READY_STATUS   BIT(4)
-#define TMU_SUPPORT_EMUL_TIME  BIT(5)
-#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(6)
+#define TMU_SUPPORT_EMUL_TIME  BIT(4)
+#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(5)
 
 #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index f81c940..c327120 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -73,7 +73,6 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
.freq_tab_count = 2,
.type = SOC_ARCH_EXYNOS4210,
.registers = &exynos4210_tmu_registers,
-   .features = TMU_SUPPORT_READY_STATUS,
},
},
.tmu_count = 1,
@@ -133,8 +132,7 @@ static const struct exynos_tmu_registers 
exynos3250_tmu_registers = {
.freq_tab_count = 2, \
.registers = &exynos3250_tmu_registers, \
.features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
-   TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
-   TMU_SUPPORT_EMUL_TIME)
+   TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_EMUL_TIME)
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS3250)
@@ -204,8 +202,7 @@ static const struct exynos_tmu_registers 
exynos4412_tmu_registers = {
.freq_tab_count = 2, \
.registers = &exynos4412_tmu_registers, \
.features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
-   TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \
-   TMU_SUPPORT_EMUL_TIME)
+   TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_EMUL_TIME)
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS4412)
@@ -291,7 +288,7 @@ static const struct exynos_tmu_registers 
exynos5260_tmu_registers = {
__EXYNOS5260_TMU_DATA \
.type = SOC_ARCH_EXYNOS5260, \
.features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
-   TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME)
+   TMU_SUPPORT_EMUL_TIME)
 
 struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
.tmu_data = {
@@ -364,14 +361,13 @@ static const struct exynos_tmu_registers 
exynos5420_tmu_registers = {
__EXYNOS5420_TMU_DATA \
.type = SOC_ARCH_EXYNOS5250, \
.features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
-   TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME)
+   TMU_SUPPORT_EMUL_TIME)
 
 #define EXYNOS5420_TM

[PATCH v2 16/33] thermal: exynos: add sanitize_temp_error() helper

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Factor out code for initializing data->temp_error[1,2] values
from exynos_tmu_initialize() into sanitize_temp_error().

This is a preparation for introducing per-SoC type tmu_initialize
method.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index e4d75a1..b0c0715 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -139,6 +139,25 @@ static void exynos_tmu_clear_irqs(struct exynos_tmu_data 
*data)
writel(val_irq, data->base + reg->tmu_intclear);
 }
 
+static void sanitize_temp_error(struct exynos_tmu_data *data, u32 trim_info)
+{
+   struct exynos_tmu_platform_data *pdata = data->pdata;
+
+   data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
+   data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) &
+   EXYNOS_TMU_TEMP_MASK);
+
+   if (!data->temp_error1 ||
+   (pdata->min_efuse_value > data->temp_error1) ||
+   (data->temp_error1 > pdata->max_efuse_value))
+   data->temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
+
+   if (!data->temp_error2)
+   data->temp_error2 =
+   (pdata->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) &
+   EXYNOS_TMU_TEMP_MASK;
+}
+
 static int exynos_tmu_initialize(struct platform_device *pdev)
 {
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
@@ -200,19 +219,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
else
trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
}
-   data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
-   data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) &
-   EXYNOS_TMU_TEMP_MASK);
-
-   if (!data->temp_error1 ||
-   (pdata->min_efuse_value > data->temp_error1) ||
-   (data->temp_error1 > pdata->max_efuse_value))
-   data->temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
-
-   if (!data->temp_error2)
-   data->temp_error2 =
-   (pdata->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) &
-   EXYNOS_TMU_TEMP_MASK;
+   sanitize_temp_error(data, trim_info);
 
rising_threshold = readl(data->base + reg->threshold_th0);
 
-- 
1.8.2.3

--
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 v2 13/33] thermal: exynos: replace threshold_falling check by Exynos SoC type one

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace pdata->threshold_falling check for non-zero value in
exynos_tmu_initialize() by an explicit check for a SoC type
(all SoC types except Exynos5440 have pdata->threshold_falling
assigned to non-zero value in their struct exynos_tmu_registers
instances).

This is a preparation for introducing per-SoC type tmu_initialize
method.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 1c15b37..4f7cad9 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -231,7 +231,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
pdata->trigger_levels[i]);
rising_threshold &= ~(0xff << 8 * i);
rising_threshold |= threshold_code << 8 * i;
-   if (pdata->threshold_falling) {
+   if (data->soc != SOC_ARCH_EXYNOS5440) {
threshold_code = temp_to_code(data,
pdata->trigger_levels[i] -
pdata->threshold_falling);
-- 
1.8.2.3

--
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 v2 18/33] thermal: exynos: add ->tmu_initialize method

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Add ->tmu_initialize method to struct exynos_tmu_data and
use it in exynos_tmu_initialize().  Then add ->tmu_initialize
implementations for Exynos4210, Exynos4412+ and Exynos5440.
Finally remove no longer needed reg->threshold_th[0,1],
reg->intclr_[fall,rise]_shift and reg->intclr_[rise,fall]_mask
abstractions.

There are more improvements available in the future on top
of this patch like merging HW_TRIP level setting with setting
of other levels for Exynos4412+ or adding separate method
for clearing IRQs using INTCLEAR register (for Exynos5420,
Exynos5260 and Exynos4412+).

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 276 +-
 drivers/thermal/samsung/exynos_tmu.h  |   5 -
 drivers/thermal/samsung/exynos_tmu_data.c |  11 --
 3 files changed, 159 insertions(+), 133 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 6e82fdd..736ef78 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -52,6 +52,7 @@
  * @temp_error2: fused value of the second point trim.
  * @regulator: pointer to the TMU regulator structure.
  * @reg_conf: pointer to structure to register with core thermal.
+ * @tmu_initialize: SoC specific TMU initialization method
  */
 struct exynos_tmu_data {
int id;
@@ -66,6 +67,7 @@ struct exynos_tmu_data {
u8 temp_error1, temp_error2;
struct regulator *regulator;
struct thermal_sensor_conf *reg_conf;
+   int (*tmu_initialize)(struct platform_device *pdev);
 };
 
 /*
@@ -180,118 +182,13 @@ static u32 get_th_reg(struct exynos_tmu_data *data, u32 
threshold, bool falling)
 static int exynos_tmu_initialize(struct platform_device *pdev)
 {
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
-   struct exynos_tmu_platform_data *pdata = data->pdata;
-   const struct exynos_tmu_registers *reg = pdata->registers;
-   unsigned int status, trim_info = 0, con, ctrl;
-   unsigned int rising_threshold = 0, falling_threshold = 0;
-   int ret = 0, threshold_code, i;
+   int ret;
 
mutex_lock(&data->lock);
clk_enable(data->clk);
if (!IS_ERR(data->clk_sec))
clk_enable(data->clk_sec);
-
-   if (data->soc != SOC_ARCH_EXYNOS5440) {
-   status = readb(data->base + EXYNOS_TMU_REG_STATUS);
-   if (!status) {
-   ret = -EBUSY;
-   goto out;
-   }
-   }
-
-   if (data->soc == SOC_ARCH_EXYNOS3250 ||
-   data->soc == SOC_ARCH_EXYNOS4412 ||
-   data->soc == SOC_ARCH_EXYNOS5250) {
-   if (data->soc == SOC_ARCH_EXYNOS3250) {
-   ctrl = readl(data->base + EXYNOS_TMU_TRIMINFO_CON1);
-   ctrl |= EXYNOS_TRIMINFO_RELOAD_ENABLE;
-   writel(ctrl, data->base + EXYNOS_TMU_TRIMINFO_CON1);
-   }
-   ctrl = readl(data->base + EXYNOS_TMU_TRIMINFO_CON2);
-   ctrl |= EXYNOS_TRIMINFO_RELOAD_ENABLE;
-   writel(ctrl, data->base + EXYNOS_TMU_TRIMINFO_CON2);
-   }
-
-   /* Save trimming info in order to perform calibration */
-   if (data->soc == SOC_ARCH_EXYNOS5440) {
-   /*
-* For exynos5440 soc triminfo value is swapped between TMU0 and
-* TMU2, so the below logic is needed.
-*/
-   switch (data->id) {
-   case 0:
-   trim_info = readl(data->base +
-   EXYNOS5440_EFUSE_SWAP_OFFSET + 
EXYNOS5440_TMU_S0_7_TRIM);
-   break;
-   case 1:
-   trim_info = readl(data->base + 
EXYNOS5440_TMU_S0_7_TRIM);
-   break;
-   case 2:
-   trim_info = readl(data->base -
-   EXYNOS5440_EFUSE_SWAP_OFFSET + 
EXYNOS5440_TMU_S0_7_TRIM);
-   }
-   } else {
-   /* On exynos5420 the triminfo register is in the shared space */
-   if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
-   trim_info = readl(data->base_second +
-   EXYNOS_TMU_REG_TRIMINFO);
-   else
-   trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
-   }
-   sanitize_temp_error(data, trim_info);
-
-   if (data->soc == SOC_ARCH_EXYNOS4210) {
-   /* Write temperature code for threshold */
-   threshold_code = temp_to_code(data, pdata->threshold);
-   writeb(threshold_code,
-   data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP);
-   for (i = 0; i < pdata->non_hw_trigger_le

[PATCH v2 15/33] thermal: exynos: remove TMU_SUPPORT_TRIM_RELOAD flag

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace TMU_SUPPORT_TRIM_RELOAD flag check in exynos_tmu_initialize()
by an explicit check for a SoC type (only Exynos3250, Exynos4412 and
Exynos5250 have TMU_SUPPORT_READY_STATUS flag set in their struct
exynos_tmu_init_data instances).  Please note that this requires
adding separate SoC type for Exynos5420 so it doesn't get mistaken
with Exynos5250.

This is a preparation for introducing per-SoC type tmu_initialize
method.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  |  5 -
 drivers/thermal/samsung/exynos_tmu.h  | 10 --
 drivers/thermal/samsung/exynos_tmu_data.c | 10 +-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 33ee527..e4d75a1 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -161,7 +161,9 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
}
}
 
-   if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) {
+   if (data->soc == SOC_ARCH_EXYNOS3250 ||
+   data->soc == SOC_ARCH_EXYNOS4412 ||
+   data->soc == SOC_ARCH_EXYNOS5250) {
if (data->soc == SOC_ARCH_EXYNOS3250) {
ctrl = readl(data->base + EXYNOS_TMU_TRIMINFO_CON1);
ctrl |= EXYNOS_TRIMINFO_RELOAD_ENABLE;
@@ -626,6 +628,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
pdata->type == SOC_ARCH_EXYNOS4412 ||
pdata->type == SOC_ARCH_EXYNOS5250 ||
pdata->type == SOC_ARCH_EXYNOS5260 ||
+   pdata->type == SOC_ARCH_EXYNOS5420 ||
pdata->type == SOC_ARCH_EXYNOS5420_TRIMINFO ||
pdata->type == SOC_ARCH_EXYNOS5440)
data->soc = pdata->type;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index d3d9205..adecc7f 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -40,6 +40,7 @@ enum soc_type {
SOC_ARCH_EXYNOS4412,
SOC_ARCH_EXYNOS5250,
SOC_ARCH_EXYNOS5260,
+   SOC_ARCH_EXYNOS5420,
SOC_ARCH_EXYNOS5420_TRIMINFO,
SOC_ARCH_EXYNOS5440,
 };
@@ -50,8 +51,6 @@ enum soc_type {
  * temperature to the TMU controller.
  * TMU_SUPPORT_MULTI_INST - This features denotes that the soc
  * has many instances of TMU.
- * TMU_SUPPORT_TRIM_RELOAD - This features shows that trimming can
- * be reloaded.
  * TMU_SUPPORT_FALLING_TRIP - This features shows that interrupt can
  * be registered for falling trips also.
  * TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation
@@ -62,10 +61,9 @@ enum soc_type {
  */
 #define TMU_SUPPORT_EMULATION  BIT(0)
 #define TMU_SUPPORT_MULTI_INST BIT(1)
-#define TMU_SUPPORT_TRIM_RELOADBIT(2)
-#define TMU_SUPPORT_FALLING_TRIP   BIT(3)
-#define TMU_SUPPORT_EMUL_TIME  BIT(4)
-#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(5)
+#define TMU_SUPPORT_FALLING_TRIP   BIT(2)
+#define TMU_SUPPORT_EMUL_TIME  BIT(3)
+#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(4)
 
 #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index c327120..1ed8bdc 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -131,8 +131,8 @@ static const struct exynos_tmu_registers 
exynos3250_tmu_registers = {
}, \
.freq_tab_count = 2, \
.registers = &exynos3250_tmu_registers, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
-   TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_EMUL_TIME)
+   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
+   TMU_SUPPORT_EMUL_TIME)
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS3250)
@@ -201,8 +201,8 @@ static const struct exynos_tmu_registers 
exynos4412_tmu_registers = {
}, \
.freq_tab_count = 2, \
.registers = &exynos4412_tmu_registers, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \
-   TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_EMUL_TIME)
+   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
+   TMU_SUPPORT_EMUL_TIME)
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS4412)
@@ -359,7 +359,7 @@ static const struct exynos_tmu_registers 
exynos5420_tmu_registers = {
 
 #define EXYNOS5420_TMU_DATA \
__EXYNOS5420_TMU_DATA \
-   .type = SOC_ARCH_EXYNOS5250, \
+   .type =

[PATCH v2 09/33] thermal: exynos: remove needless emul_time_shift abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->emul_time_shift is used only in exynos_tmu_set_emulation()
and accessed only if TMU_SUPPORT_EMUL_TIME flag is set.  This
flag is not set for Exynos4210 and Exynos5440 (reg->emul_time_shift
field is not even assigned in exynos[4210,5440]_tmu_registers
and is assigned to identical value for all other SoC types) so
the abstraction is not needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 4 ++--
 drivers/thermal/samsung/exynos_tmu.h  | 2 --
 drivers/thermal/samsung/exynos_tmu_data.c | 4 
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index c108a1f..e35c289 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -380,8 +380,8 @@ static int exynos_tmu_set_emulation(void *drv_data, 
unsigned long temp)
temp /= MCELSIUS;
 
if (TMU_SUPPORTS(pdata, EMUL_TIME)) {
-   val &= ~(EXYNOS_EMUL_TIME_MASK << reg->emul_time_shift);
-   val |= (EXYNOS_EMUL_TIME << reg->emul_time_shift);
+   val &= ~(EXYNOS_EMUL_TIME_MASK << 
EXYNOS_EMUL_TIME_SHIFT);
+   val |= (EXYNOS_EMUL_TIME << EXYNOS_EMUL_TIME_SHIFT);
}
val &= ~(EXYNOS_EMUL_DATA_MASK << EXYNOS_EMUL_DATA_SHIFT);
val |= (temp_to_code(data, temp) << EXYNOS_EMUL_DATA_SHIFT) |
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index ed3d816..2694298 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -92,7 +92,6 @@ enum soc_type {
  * @tmu_intstat: Register containing the interrupt status values.
  * @tmu_intclear: Register for clearing the raised interrupt status.
  * @emul_con: TMU emulation controller register.
- * @emul_time_shift: shift bits of emulation time.
  * @tmu_irqstatus: register to find which TMU generated interrupts.
  * @tmu_pmin: register to get/set the Pmin value.
  */
@@ -118,7 +117,6 @@ struct exynos_tmu_registers {
u32 tmu_intclear;
 
u32 emul_con;
-   u32 emul_time_shift;
 
u32 tmu_irqstatus;
u32 tmu_pmin;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index c35a6ea..cef0b97 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -94,7 +94,6 @@ static const struct exynos_tmu_registers 
exynos3250_tmu_registers = {
.tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
.emul_con = EXYNOS_EMUL_CON,
-   .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
 #define EXYNOS3250_TMU_DATA \
@@ -166,7 +165,6 @@ static const struct exynos_tmu_registers 
exynos4412_tmu_registers = {
.tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
.emul_con = EXYNOS_EMUL_CON,
-   .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
 #define EXYNOS4412_TMU_DATA \
@@ -250,7 +248,6 @@ static const struct exynos_tmu_registers 
exynos5260_tmu_registers = {
.tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR,
.emul_con = EXYNOS5260_EMUL_CON,
-   .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
 #define __EXYNOS5260_TMU_DATA  \
@@ -324,7 +321,6 @@ static const struct exynos_tmu_registers 
exynos5420_tmu_registers = {
.tmu_intstat = EXYNOS_TMU_REG_INTSTAT,
.tmu_intclear = EXYNOS_TMU_REG_INTCLEAR,
.emul_con = EXYNOS_EMUL_CON,
-   .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT,
 };
 
 #define __EXYNOS5420_TMU_DATA  \
-- 
1.8.2.3

--
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 v2 17/33] thermal: exynos: add get_th_reg() helper

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Factor out code for preparing threshold register value from
exynos_tmu_initialize() into get_th_reg().

This is a preparation for introducing per-SoC type tmu_initialize
method.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c | 37 ++--
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index b0c0715..6e82fdd 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -158,6 +158,25 @@ static void sanitize_temp_error(struct exynos_tmu_data 
*data, u32 trim_info)
EXYNOS_TMU_TEMP_MASK;
 }
 
+static u32 get_th_reg(struct exynos_tmu_data *data, u32 threshold, bool 
falling)
+{
+   struct exynos_tmu_platform_data *pdata = data->pdata;
+   int i;
+
+   for (i = 0; i < pdata->non_hw_trigger_levels; i++) {
+   u8 temp = pdata->trigger_levels[i];
+
+   if (falling)
+   temp -= pdata->threshold_falling;
+   else
+   threshold &= ~(0xff << 8 * i);
+
+   threshold |= temp_to_code(data, temp) << 8 * i;
+   }
+
+   return threshold;
+}
+
 static int exynos_tmu_initialize(struct platform_device *pdev)
 {
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
@@ -221,8 +240,6 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
}
sanitize_temp_error(data, trim_info);
 
-   rising_threshold = readl(data->base + reg->threshold_th0);
-
if (data->soc == SOC_ARCH_EXYNOS4210) {
/* Write temperature code for threshold */
threshold_code = temp_to_code(data, pdata->threshold);
@@ -235,18 +252,10 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
exynos_tmu_clear_irqs(data);
} else {
/* Write temperature code for rising and falling threshold */
-   for (i = 0; i < pdata->non_hw_trigger_levels; i++) {
-   threshold_code = temp_to_code(data,
-   pdata->trigger_levels[i]);
-   rising_threshold &= ~(0xff << 8 * i);
-   rising_threshold |= threshold_code << 8 * i;
-   if (data->soc != SOC_ARCH_EXYNOS5440) {
-   threshold_code = temp_to_code(data,
-   pdata->trigger_levels[i] -
-   pdata->threshold_falling);
-   falling_threshold |= threshold_code << 8 * i;
-   }
-   }
+   rising_threshold = readl(data->base + reg->threshold_th0);
+   rising_threshold = get_th_reg(data, rising_threshold, false);
+   if (data->soc != SOC_ARCH_EXYNOS5440)
+   falling_threshold = get_th_reg(data, 0, true);
 
writel(rising_threshold,
data->base + reg->threshold_th0);
-- 
1.8.2.3

--
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 v2 28/33] thermal: exynos: remove TMU_SUPPORT_ADDRESS_MULTIPLE flag

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace TMU_SUPPORT_ADDRESS_MULTIPLE flag check in exynos_map_dt_data()
by an explicit check for a SoC type (only Exynos5420 with TRIMINFO
quirk and Exynos5440 have TMU_SUPPORT_ADDRESS_MULTIPLE flag set in
their struct exynos_tmu_init_data instances).

Please note that this requires moving SoC type assignment and verification
from exynos_tmu_probe() to exynos_map_dt_data() so it happens earlier
(which is a good thing in itself).

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 72 +++
 drivers/thermal/samsung/exynos_tmu.h  |  3 --
 drivers/thermal/samsung/exynos_tmu_data.c |  5 +--
 3 files changed, 38 insertions(+), 42 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 51d8cc7..65eeecc 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -473,7 +473,6 @@ static void exynos5440_tmu_set_emulation(struct 
exynos_tmu_data *data,
 static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
 {
struct exynos_tmu_data *data = drv_data;
-   struct exynos_tmu_platform_data *pdata = data->pdata;
int ret = -EINVAL;
 
if (data->soc == SOC_ARCH_EXYNOS4210)
@@ -696,12 +695,47 @@ static int exynos_map_dt_data(struct platform_device 
*pdev)
dev_err(&pdev->dev, "No platform init data supplied.\n");
return -ENODEV;
}
+
data->pdata = pdata;
+   data->soc = pdata->type;
+
+   switch (data->soc) {
+   case SOC_ARCH_EXYNOS4210:
+   data->tmu_initialize = exynos4210_tmu_initialize;
+   data->tmu_control = exynos4210_tmu_control;
+   data->tmu_read = exynos4210_tmu_read;
+   data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
+   break;
+   case SOC_ARCH_EXYNOS3250:
+   case SOC_ARCH_EXYNOS4412:
+   case SOC_ARCH_EXYNOS5250:
+   case SOC_ARCH_EXYNOS5260:
+   case SOC_ARCH_EXYNOS5420:
+   case SOC_ARCH_EXYNOS5420_TRIMINFO:
+   data->tmu_initialize = exynos4412_tmu_initialize;
+   data->tmu_control = exynos4210_tmu_control;
+   data->tmu_read = exynos4412_tmu_read;
+   data->tmu_set_emulation = exynos4412_tmu_set_emulation;
+   data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
+   break;
+   case SOC_ARCH_EXYNOS5440:
+   data->tmu_initialize = exynos5440_tmu_initialize;
+   data->tmu_control = exynos5440_tmu_control;
+   data->tmu_read = exynos5440_tmu_read;
+   data->tmu_set_emulation = exynos5440_tmu_set_emulation;
+   data->tmu_clear_irqs = exynos5440_tmu_clear_irqs;
+   break;
+   default:
+   dev_err(&pdev->dev, "Platform not supported\n");
+   return -EINVAL;
+   }
+
/*
 * Check if the TMU shares some registers and then try to map the
 * memory of common registers.
 */
-   if (!TMU_SUPPORTS(pdata, ADDRESS_MULTIPLE))
+   if (data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO &&
+   data->soc != SOC_ARCH_EXYNOS5440)
return 0;
 
if (of_address_to_resource(pdev->dev.of_node, 1, &res)) {
@@ -768,40 +802,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
goto err_clk_sec;
}
 
-   data->soc = pdata->type;
-
-   switch (data->soc) {
-   case SOC_ARCH_EXYNOS4210:
-   data->tmu_initialize = exynos4210_tmu_initialize;
-   data->tmu_control = exynos4210_tmu_control;
-   data->tmu_read = exynos4210_tmu_read;
-   data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
-   break;
-   case SOC_ARCH_EXYNOS3250:
-   case SOC_ARCH_EXYNOS4412:
-   case SOC_ARCH_EXYNOS5250:
-   case SOC_ARCH_EXYNOS5260:
-   case SOC_ARCH_EXYNOS5420:
-   case SOC_ARCH_EXYNOS5420_TRIMINFO:
-   data->tmu_initialize = exynos4412_tmu_initialize;
-   data->tmu_control = exynos4210_tmu_control;
-   data->tmu_read = exynos4412_tmu_read;
-   data->tmu_set_emulation = exynos4412_tmu_set_emulation;
-   data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
-   break;
-   case SOC_ARCH_EXYNOS5440:
-   data->tmu_initialize = exynos5440_tmu_initialize;
-   data->tmu_control = exynos5440_tmu_control;
-   data->tmu_read = exynos5440_tmu_read;
-   data->tmu_set_emulation = exynos5440_tmu_set_emulation;
-   data->tmu_clear_irqs = exynos5440_tmu_clear_irqs;
-   break;
-   default:
-   ret = -EINVAL;
-   dev_err(&pdev->dev, "Platform no

[PATCH v2 27/33] thermal: exynos: remove TMU_SUPPORT_EMULATION flag

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace TMU_SUPPORT_EMULATION flag check in exynos_tmu_set_emulation()
by an explicit check for a SoC type (all SoC types except Exynos4210
have TMU_SUPPORT_EMULATION flag set in their struct exynos_tmu_init_data
instances).

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  |  2 +-
 drivers/thermal/samsung/exynos_tmu.h  |  7 ++-
 drivers/thermal/samsung/exynos_tmu_data.c | 17 ++---
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 209221f..51d8cc7 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -476,7 +476,7 @@ static int exynos_tmu_set_emulation(void *drv_data, 
unsigned long temp)
struct exynos_tmu_platform_data *pdata = data->pdata;
int ret = -EINVAL;
 
-   if (!TMU_SUPPORTS(pdata, EMULATION))
+   if (data->soc == SOC_ARCH_EXYNOS4210)
goto out;
 
if (temp && temp < MCELSIUS)
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index d90852a..5ad3f3f 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -47,17 +47,14 @@ enum soc_type {
 
 /**
  * EXYNOS TMU supported features.
- * TMU_SUPPORT_EMULATION - This features is used to set user defined
- * temperature to the TMU controller.
  * TMU_SUPPORT_MULTI_INST - This features denotes that the soc
  * has many instances of TMU.
  * TMU_SUPPORT_ADDRESS_MULTIPLE - This feature tells that the different TMU
  * sensors shares some common registers.
  * TMU_SUPPORT - macro to compare the above features with the supplied.
  */
-#define TMU_SUPPORT_EMULATION  BIT(0)
-#define TMU_SUPPORT_MULTI_INST BIT(1)
-#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(2)
+#define TMU_SUPPORT_MULTI_INST BIT(0)
+#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(1)
 
 #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 82f1cba..4dd8d1c 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -100,8 +100,7 @@ struct exynos_tmu_init_data const 
exynos4210_default_tmu_data = {
.freq_clip_max = 400 * 1000, \
.temp_level = 95, \
}, \
-   .freq_tab_count = 2, \
-   .features = TMU_SUPPORT_EMULATION
+   .freq_tab_count = 2
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS3250)
@@ -152,8 +151,7 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
.freq_clip_max = 400 * 1000, \
.temp_level = 95, \
}, \
-   .freq_tab_count = 2, \
-   .features = TMU_SUPPORT_EMULATION
+   .freq_tab_count = 2
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS4412)
@@ -220,8 +218,7 @@ struct exynos_tmu_init_data const 
exynos5250_default_tmu_data = {
 
 #define EXYNOS5260_TMU_DATA \
__EXYNOS5260_TMU_DATA \
-   .type = SOC_ARCH_EXYNOS5260, \
-   .features = TMU_SUPPORT_EMULATION
+   .type = SOC_ARCH_EXYNOS5260
 
 struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
.tmu_data = {
@@ -274,13 +271,12 @@ struct exynos_tmu_init_data const 
exynos5260_default_tmu_data = {
 
 #define EXYNOS5420_TMU_DATA \
__EXYNOS5420_TMU_DATA \
-   .type = SOC_ARCH_EXYNOS5420, \
-   .features = TMU_SUPPORT_EMULATION
+   .type = SOC_ARCH_EXYNOS5420
 
 #define EXYNOS5420_TMU_DATA_SHARED \
__EXYNOS5420_TMU_DATA \
.type = SOC_ARCH_EXYNOS5420_TRIMINFO, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_ADDRESS_MULTIPLE)
+   .features = TMU_SUPPORT_ADDRESS_MULTIPLE
 
 struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
.tmu_data = {
@@ -314,8 +310,7 @@ struct exynos_tmu_init_data const 
exynos5420_default_tmu_data = {
.second_point_trim = 70, \
.default_temp_offset = 25, \
.type = SOC_ARCH_EXYNOS5440, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_MULTI_INST | \
-   TMU_SUPPORT_ADDRESS_MULTIPLE),
+   .features = (TMU_SUPPORT_MULTI_INST | TMU_SUPPORT_ADDRESS_MULTIPLE),
 
 struct exynos_tmu_init_data const exynos5440_default_tmu_data = {
.tmu_data = {
-- 
1.8.2.3

--
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 v2 19/33] thermal: exynos: add get_con_reg() helper

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Factor out code for preparing TMU_CONTROL register value from
exynos_tmu_control() into get_con_reg().

This is a preparation for introducing per-SoC type tmu_control
method.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 736ef78..f65e6d8 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -197,17 +197,9 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
return ret;
 }
 
-static void exynos_tmu_control(struct platform_device *pdev, bool on)
+static u32 get_con_reg(struct exynos_tmu_data *data, u32 con)
 {
-   struct exynos_tmu_data *data = platform_get_drvdata(pdev);
struct exynos_tmu_platform_data *pdata = data->pdata;
-   const struct exynos_tmu_registers *reg = pdata->registers;
-   unsigned int con, interrupt_en;
-
-   mutex_lock(&data->lock);
-   clk_enable(data->clk);
-
-   con = readl(data->base + reg->tmu_ctrl);
 
if (pdata->test_mux)
con |= (pdata->test_mux << EXYNOS4412_MUX_ADDR_SHIFT);
@@ -223,6 +215,21 @@ static void exynos_tmu_control(struct platform_device 
*pdev, bool on)
con |= (pdata->noise_cancel_mode << EXYNOS_TMU_TRIP_MODE_SHIFT);
}
 
+   return con;
+}
+
+static void exynos_tmu_control(struct platform_device *pdev, bool on)
+{
+   struct exynos_tmu_data *data = platform_get_drvdata(pdev);
+   struct exynos_tmu_platform_data *pdata = data->pdata;
+   const struct exynos_tmu_registers *reg = pdata->registers;
+   unsigned int con, interrupt_en;
+
+   mutex_lock(&data->lock);
+   clk_enable(data->clk);
+
+   con = get_con_reg(data, readl(data->base + reg->tmu_ctrl));
+
if (on) {
con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
interrupt_en =
-- 
1.8.2.3

--
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 v2 25/33] thermal: exynos: remove TMU_SUPPORT_FALLING_TRIP flag

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace TMU_SUPPORT_FALLING_TRIP flag check in
exynos[4210,5440]_tmu_control() by an explicit check
for a SoC type (all SoC types except Exynos4210 have
TMU_SUPPORT_FALLING_TRIP flag set in their struct
exynos_tmu_init_data instances).

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  |  6 ++
 drivers/thermal/samsung/exynos_tmu.h  |  7 ++-
 drivers/thermal/samsung/exynos_tmu_data.c | 20 
 3 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 1b3c2f4..6795ddc 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -373,7 +373,7 @@ static void exynos4210_tmu_control(struct platform_device 
*pdev, bool on)
pdata->trigger_enable[2] << 
EXYNOS_TMU_INTEN_RISE2_SHIFT |
pdata->trigger_enable[1] << 
EXYNOS_TMU_INTEN_RISE1_SHIFT |
pdata->trigger_enable[0] << 
EXYNOS_TMU_INTEN_RISE0_SHIFT;
-   if (TMU_SUPPORTS(pdata, FALLING_TRIP))
+   if (data->soc != SOC_ARCH_EXYNOS4210)
interrupt_en |=
interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;
} else {
@@ -399,9 +399,7 @@ static void exynos5440_tmu_control(struct platform_device 
*pdev, bool on)
pdata->trigger_enable[2] << 
EXYNOS5440_TMU_INTEN_RISE2_SHIFT |
pdata->trigger_enable[1] << 
EXYNOS5440_TMU_INTEN_RISE1_SHIFT |
pdata->trigger_enable[0] << 
EXYNOS5440_TMU_INTEN_RISE0_SHIFT;
-   if (TMU_SUPPORTS(pdata, FALLING_TRIP))
-   interrupt_en |=
-   interrupt_en << 
EXYNOS5440_TMU_INTEN_FALL0_SHIFT;
+   interrupt_en |= interrupt_en << 
EXYNOS5440_TMU_INTEN_FALL0_SHIFT;
} else {
con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
interrupt_en = 0; /* Disable all interrupts */
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index c4c0aa5..ed83d3d 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -51,8 +51,6 @@ enum soc_type {
  * temperature to the TMU controller.
  * TMU_SUPPORT_MULTI_INST - This features denotes that the soc
  * has many instances of TMU.
- * TMU_SUPPORT_FALLING_TRIP - This features shows that interrupt can
- * be registered for falling trips also.
  * TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation
  * sample time.
  * TMU_SUPPORT_ADDRESS_MULTIPLE - This feature tells that the different TMU
@@ -61,9 +59,8 @@ enum soc_type {
  */
 #define TMU_SUPPORT_EMULATION  BIT(0)
 #define TMU_SUPPORT_MULTI_INST BIT(1)
-#define TMU_SUPPORT_FALLING_TRIP   BIT(2)
-#define TMU_SUPPORT_EMUL_TIME  BIT(3)
-#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(4)
+#define TMU_SUPPORT_EMUL_TIME  BIT(2)
+#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(3)
 
 #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index d35ec15..39b9651 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -101,8 +101,7 @@ struct exynos_tmu_init_data const 
exynos4210_default_tmu_data = {
.temp_level = 95, \
}, \
.freq_tab_count = 2, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
-   TMU_SUPPORT_EMUL_TIME)
+   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME)
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS3250)
@@ -154,8 +153,7 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
.temp_level = 95, \
}, \
.freq_tab_count = 2, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
-   TMU_SUPPORT_EMUL_TIME)
+   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME)
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS4412)
@@ -223,8 +221,7 @@ struct exynos_tmu_init_data const 
exynos5250_default_tmu_data = {
 #define EXYNOS5260_TMU_DATA \
__EXYNOS5260_TMU_DATA \
.type = SOC_ARCH_EXYNOS5260, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \
-   TMU_SUPPORT_EMUL_TIME)
+   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME)
 
 struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
.tmu_data = {
@@ -278,14 +275,13 @@ struct exyn

[PATCH v2 24/33] thermal: exynos: add ->tmu_clear_irqs method

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Add ->tmu_clear_irqs method to struct exynos_tmu_data and use
it instead exynos_tmu_clear_irqs().  Then add ->tmu_clear_irqs
implementations for Exynos4210+ and Exynos5440.  Finally
remove no longer needed reg->tmu_int[stat,clear] abstractions
and struct exynos_tmu_registers instances.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 64 +--
 drivers/thermal/samsung/exynos_tmu.h  | 14 ---
 drivers/thermal/samsung/exynos_tmu_data.c | 36 -
 3 files changed, 43 insertions(+), 71 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 01aa548..1b3c2f4 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -56,6 +56,7 @@
  * @tmu_control: SoC specific TMU control method
  * @tmu_read: SoC specific TMU temperature read method
  * @tmu_set_emulation: SoC specific TMU emulation setting method
+ * @tmu_clear_irqs: SoC specific TMU interrupts clearing method
  */
 struct exynos_tmu_data {
int id;
@@ -75,6 +76,7 @@ struct exynos_tmu_data {
int (*tmu_read)(struct exynos_tmu_data *data);
void (*tmu_set_emulation)(struct exynos_tmu_data *data,
  unsigned long temp);
+   void (*tmu_clear_irqs)(struct exynos_tmu_data *data);
 };
 
 /*
@@ -131,23 +133,6 @@ static int code_to_temp(struct exynos_tmu_data *data, u8 
temp_code)
return temp;
 }
 
-static void exynos_tmu_clear_irqs(struct exynos_tmu_data *data)
-{
-   const struct exynos_tmu_registers *reg = data->pdata->registers;
-   unsigned int val_irq;
-
-   val_irq = readl(data->base + reg->tmu_intstat);
-   /*
-* Clear the interrupts.  Please note that the documentation for
-* Exynos3250, Exynos4412, Exynos5250 and Exynos5260 incorrectly
-* states that INTCLEAR register has a different placing of bits
-* responsible for FALL IRQs than INTSTAT register.  Exynos5420
-* and Exynos5440 documentation is correct (Exynos4210 doesn't
-* support FALL IRQs at all).
-*/
-   writel(val_irq, data->base + reg->tmu_intclear);
-}
-
 static void sanitize_temp_error(struct exynos_tmu_data *data, u32 trim_info)
 {
struct exynos_tmu_platform_data *pdata = data->pdata;
@@ -259,7 +244,7 @@ static int exynos4210_tmu_initialize(struct platform_device 
*pdev)
writeb(pdata->trigger_levels[i], data->base +
   EXYNOS4210_TMU_REG_TRIG_LEVEL0 + i * 4);
 
-   exynos_tmu_clear_irqs(data);
+   data->tmu_clear_irqs(data);
 out:
return ret;
 }
@@ -304,7 +289,7 @@ static int exynos4412_tmu_initialize(struct platform_device 
*pdev)
writel(rising_threshold, data->base + EXYNOS_THD_TEMP_RISE);
writel(get_th_reg(data, 0, true), data->base + EXYNOS_THD_TEMP_FALL);
 
-   exynos_tmu_clear_irqs(data);
+   data->tmu_clear_irqs(data);
 
/* if last threshold limit is also present */
i = pdata->max_trigger_level - 1;
@@ -353,7 +338,7 @@ static int exynos5440_tmu_initialize(struct platform_device 
*pdev)
writel(rising_threshold, data->base + EXYNOS5440_TMU_S0_7_TH0);
writel(0, data->base + EXYNOS5440_TMU_S0_7_TH1);
 
-   exynos_tmu_clear_irqs(data);
+   data->tmu_clear_irqs(data);
 
/* if last threshold limit is also present */
i = pdata->max_trigger_level - 1;
@@ -557,7 +542,7 @@ static void exynos_tmu_work(struct work_struct *work)
clk_enable(data->clk);
 
/* TODO: take action based on particular interrupt */
-   exynos_tmu_clear_irqs(data);
+   data->tmu_clear_irqs(data);
 
clk_disable(data->clk);
mutex_unlock(&data->lock);
@@ -565,6 +550,40 @@ out:
enable_irq(data->irq);
 }
 
+static void exynos4210_tmu_clear_irqs(struct exynos_tmu_data *data)
+{
+   unsigned int val_irq;
+   u32 tmu_intstat, tmu_intclear;
+
+   if (data->soc == SOC_ARCH_EXYNOS5260) {
+   tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT;
+   tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR;
+   } else {
+   tmu_intstat = EXYNOS_TMU_REG_INTSTAT;
+   tmu_intclear = EXYNOS_TMU_REG_INTCLEAR;
+   }
+
+   val_irq = readl(data->base + tmu_intstat);
+   /*
+* Clear the interrupts.  Please note that the documentation for
+* Exynos3250, Exynos4412, Exynos5250 and Exynos5260 incorrectly
+* states that INTCLEAR register has a different placing of bits
+* responsible for FALL IRQs than INTSTAT register.  Exynos5420
+* and Exynos5440 documentation is correct (Exynos4210 doesn't
+* support FALL IRQs at all).
+*/
+   writel(val_irq, data->base + tmu_intclear);
+}
+
+st

[PATCH v2 26/33] thermal: exynos: remove TMU_SUPPORT_EMUL_TIME flag

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace TMU_SUPPORT_EMUL_TIME flag check in get_emul_con_reg()
by an explicit check for a SoC type (all SoC types except
Exynos4210 and Exynos5440 have TMU_SUPPORT_EMUL_TIME flag set
in their struct exynos_tmu_init_data instances).

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  |  4 +---
 drivers/thermal/samsung/exynos_tmu.h  |  5 +
 drivers/thermal/samsung/exynos_tmu_data.c | 11 +--
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 6795ddc..209221f 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -427,12 +427,10 @@ static int exynos_tmu_read(struct exynos_tmu_data *data)
 static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
unsigned long temp)
 {
-   struct exynos_tmu_platform_data *pdata = data->pdata;
-
if (temp) {
temp /= MCELSIUS;
 
-   if (TMU_SUPPORTS(pdata, EMUL_TIME)) {
+   if (data->soc != SOC_ARCH_EXYNOS5440) {
val &= ~(EXYNOS_EMUL_TIME_MASK << 
EXYNOS_EMUL_TIME_SHIFT);
val |= (EXYNOS_EMUL_TIME << EXYNOS_EMUL_TIME_SHIFT);
}
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index ed83d3d..d90852a 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -51,16 +51,13 @@ enum soc_type {
  * temperature to the TMU controller.
  * TMU_SUPPORT_MULTI_INST - This features denotes that the soc
  * has many instances of TMU.
- * TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation
- * sample time.
  * TMU_SUPPORT_ADDRESS_MULTIPLE - This feature tells that the different TMU
  * sensors shares some common registers.
  * TMU_SUPPORT - macro to compare the above features with the supplied.
  */
 #define TMU_SUPPORT_EMULATION  BIT(0)
 #define TMU_SUPPORT_MULTI_INST BIT(1)
-#define TMU_SUPPORT_EMUL_TIME  BIT(2)
-#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(3)
+#define TMU_SUPPORT_ADDRESS_MULTIPLE   BIT(2)
 
 #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
 
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 39b9651..82f1cba 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -101,7 +101,7 @@ struct exynos_tmu_init_data const 
exynos4210_default_tmu_data = {
.temp_level = 95, \
}, \
.freq_tab_count = 2, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME)
+   .features = TMU_SUPPORT_EMULATION
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS3250)
@@ -153,7 +153,7 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
.temp_level = 95, \
}, \
.freq_tab_count = 2, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME)
+   .features = TMU_SUPPORT_EMULATION
 #endif
 
 #if defined(CONFIG_SOC_EXYNOS4412)
@@ -221,7 +221,7 @@ struct exynos_tmu_init_data const 
exynos5250_default_tmu_data = {
 #define EXYNOS5260_TMU_DATA \
__EXYNOS5260_TMU_DATA \
.type = SOC_ARCH_EXYNOS5260, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME)
+   .features = TMU_SUPPORT_EMULATION
 
 struct exynos_tmu_init_data const exynos5260_default_tmu_data = {
.tmu_data = {
@@ -275,13 +275,12 @@ struct exynos_tmu_init_data const 
exynos5260_default_tmu_data = {
 #define EXYNOS5420_TMU_DATA \
__EXYNOS5420_TMU_DATA \
.type = SOC_ARCH_EXYNOS5420, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME)
+   .features = TMU_SUPPORT_EMULATION
 
 #define EXYNOS5420_TMU_DATA_SHARED \
__EXYNOS5420_TMU_DATA \
.type = SOC_ARCH_EXYNOS5420_TRIMINFO, \
-   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_EMUL_TIME | \
-   TMU_SUPPORT_ADDRESS_MULTIPLE)
+   .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_ADDRESS_MULTIPLE)
 
 struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
.tmu_data = {
-- 
1.8.2.3

--
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 v2 22/33] thermal: exynos: add get_emul_con_reg() helper

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Factor out code for preparing EMUL_CON register value from
exynos_tmu_set_emulation() into get_emul_con_reg().

This is a preparation for introducing per-SoC type
tmu_set_emulation method.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c | 38 ++--
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index b209593..1b622ce 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -438,6 +438,28 @@ static int exynos_tmu_read(struct exynos_tmu_data *data)
 }
 
 #ifdef CONFIG_THERMAL_EMULATION
+static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val,
+   unsigned long temp)
+{
+   struct exynos_tmu_platform_data *pdata = data->pdata;
+
+   if (temp) {
+   temp /= MCELSIUS;
+
+   if (TMU_SUPPORTS(pdata, EMUL_TIME)) {
+   val &= ~(EXYNOS_EMUL_TIME_MASK << 
EXYNOS_EMUL_TIME_SHIFT);
+   val |= (EXYNOS_EMUL_TIME << EXYNOS_EMUL_TIME_SHIFT);
+   }
+   val &= ~(EXYNOS_EMUL_DATA_MASK << EXYNOS_EMUL_DATA_SHIFT);
+   val |= (temp_to_code(data, temp) << EXYNOS_EMUL_DATA_SHIFT) |
+   EXYNOS_EMUL_ENABLE;
+   } else {
+   val &= ~EXYNOS_EMUL_ENABLE;
+   }
+
+   return val;
+}
+
 static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
 {
struct exynos_tmu_data *data = drv_data;
@@ -456,21 +478,7 @@ static int exynos_tmu_set_emulation(void *drv_data, 
unsigned long temp)
clk_enable(data->clk);
 
val = readl(data->base + reg->emul_con);
-
-   if (temp) {
-   temp /= MCELSIUS;
-
-   if (TMU_SUPPORTS(pdata, EMUL_TIME)) {
-   val &= ~(EXYNOS_EMUL_TIME_MASK << 
EXYNOS_EMUL_TIME_SHIFT);
-   val |= (EXYNOS_EMUL_TIME << EXYNOS_EMUL_TIME_SHIFT);
-   }
-   val &= ~(EXYNOS_EMUL_DATA_MASK << EXYNOS_EMUL_DATA_SHIFT);
-   val |= (temp_to_code(data, temp) << EXYNOS_EMUL_DATA_SHIFT) |
-   EXYNOS_EMUL_ENABLE;
-   } else {
-   val &= ~EXYNOS_EMUL_ENABLE;
-   }
-
+   val = get_emul_con_reg(data, val, temp);
writel(val, data->base + reg->emul_con);
 
clk_disable(data->clk);
-- 
1.8.2.3

--
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 v2 21/33] thermal: exynos: add ->tmu_read method

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Add ->tmu_read method to struct exynos_tmu_data and use it
in exynos_tmu_control().  Then add ->tmu_read implementations
for Exynos4210, Exynos4412+ and Exynos5440.  Finally remove
no longer needed reg->tmu_cur_temp abstractions.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 45 +++
 drivers/thermal/samsung/exynos_tmu.h  |  2 --
 drivers/thermal/samsung/exynos_tmu_data.c |  6 -
 3 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 938e8e63..b209593 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -54,6 +54,7 @@
  * @reg_conf: pointer to structure to register with core thermal.
  * @tmu_initialize: SoC specific TMU initialization method
  * @tmu_control: SoC specific TMU control method
+ * @tmu_read: SoC specific TMU temperature read method
  */
 struct exynos_tmu_data {
int id;
@@ -70,6 +71,7 @@ struct exynos_tmu_data {
struct thermal_sensor_conf *reg_conf;
int (*tmu_initialize)(struct platform_device *pdev);
void (*tmu_control)(struct platform_device *pdev, bool on);
+   int (*tmu_read)(struct exynos_tmu_data *data);
 };
 
 /*
@@ -422,29 +424,17 @@ static void exynos5440_tmu_control(struct platform_device 
*pdev, bool on)
 
 static int exynos_tmu_read(struct exynos_tmu_data *data)
 {
-   struct exynos_tmu_platform_data *pdata = data->pdata;
-   const struct exynos_tmu_registers *reg = pdata->registers;
-   u8 temp_code;
-   int temp;
+   int ret;
 
mutex_lock(&data->lock);
clk_enable(data->clk);
-
-   temp_code = readb(data->base + reg->tmu_cur_temp);
-
-   if (data->soc == SOC_ARCH_EXYNOS4210)
-   /* temp_code should range between 75 and 175 */
-   if (temp_code < 75 || temp_code > 175) {
-   temp = -ENODATA;
-   goto out;
-   }
-
-   temp = code_to_temp(data, temp_code);
-out:
+   ret = data->tmu_read(data);
+   if (ret >= 0)
+   ret = code_to_temp(data, ret);
clk_disable(data->clk);
mutex_unlock(&data->lock);
 
-   return temp;
+   return ret;
 }
 
 #ifdef CONFIG_THERMAL_EMULATION
@@ -494,6 +484,24 @@ static int exynos_tmu_set_emulation(void *drv_data,
unsigned long temp)
{ return -EINVAL; }
 #endif/*CONFIG_THERMAL_EMULATION*/
 
+static int exynos4210_tmu_read(struct exynos_tmu_data *data)
+{
+   int ret = readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP);
+
+   /* "temp_code" should range between 75 and 175 */
+   return (ret < 75 || ret > 175) ? -ENODATA : ret;
+}
+
+static int exynos4412_tmu_read(struct exynos_tmu_data *data)
+{
+   return readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP);
+}
+
+static int exynos5440_tmu_read(struct exynos_tmu_data *data)
+{
+   return readb(data->base + EXYNOS5440_TMU_S0_7_TEMP);
+}
+
 static void exynos_tmu_work(struct work_struct *work)
 {
struct exynos_tmu_data *data = container_of(work,
@@ -718,6 +726,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
case SOC_ARCH_EXYNOS4210:
data->tmu_initialize = exynos4210_tmu_initialize;
data->tmu_control = exynos4210_tmu_control;
+   data->tmu_read = exynos4210_tmu_read;
break;
case SOC_ARCH_EXYNOS3250:
case SOC_ARCH_EXYNOS4412:
@@ -727,10 +736,12 @@ static int exynos_tmu_probe(struct platform_device *pdev)
case SOC_ARCH_EXYNOS5420_TRIMINFO:
data->tmu_initialize = exynos4412_tmu_initialize;
data->tmu_control = exynos4210_tmu_control;
+   data->tmu_read = exynos4412_tmu_read;
break;
case SOC_ARCH_EXYNOS5440:
data->tmu_initialize = exynos5440_tmu_initialize;
data->tmu_control = exynos5440_tmu_control;
+   data->tmu_read = exynos5440_tmu_read;
break;
default:
ret = -EINVAL;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 7496b54..9460e6e 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -70,13 +70,11 @@ enum soc_type {
 /**
  * struct exynos_tmu_register - register descriptors to access registers.
  * The register validity may vary slightly across different exynos SOC's.
- * @tmu_cur_temp: register containing the current temperature of the TMU.
  * @tmu_intstat: Register containing the interrupt status values.
  * @tmu_intclear: Register for clearing the raised interrupt status.
  * @emul_con: TMU emulation controller register.
  */
 struct exynos_tmu_regist

[PATCH v2 20/33] thermal: exynos: add ->tmu_control method

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Add ->tmu_control method to struct exynos_tmu_data and use it
in exynos_tmu_control().  Then add ->tmu_control implementations
for Exynos4210+ and Exynos5440.  Finally remove no longer needed
reg->tmu_[ctrl,inten], reg->inten_rise[0,1,2,3]_shift and
reg->inten_fall0_shift abstractions.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 81 ++-
 drivers/thermal/samsung/exynos_tmu.h  | 25 +-
 drivers/thermal/samsung/exynos_tmu_data.c | 41 
 3 files changed, 60 insertions(+), 87 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index f65e6d8..938e8e63 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -53,6 +53,7 @@
  * @regulator: pointer to the TMU regulator structure.
  * @reg_conf: pointer to structure to register with core thermal.
  * @tmu_initialize: SoC specific TMU initialization method
+ * @tmu_control: SoC specific TMU control method
  */
 struct exynos_tmu_data {
int id;
@@ -68,6 +69,7 @@ struct exynos_tmu_data {
struct regulator *regulator;
struct thermal_sensor_conf *reg_conf;
int (*tmu_initialize)(struct platform_device *pdev);
+   void (*tmu_control)(struct platform_device *pdev, bool on);
 };
 
 /*
@@ -221,32 +223,10 @@ static u32 get_con_reg(struct exynos_tmu_data *data, u32 
con)
 static void exynos_tmu_control(struct platform_device *pdev, bool on)
 {
struct exynos_tmu_data *data = platform_get_drvdata(pdev);
-   struct exynos_tmu_platform_data *pdata = data->pdata;
-   const struct exynos_tmu_registers *reg = pdata->registers;
-   unsigned int con, interrupt_en;
 
mutex_lock(&data->lock);
clk_enable(data->clk);
-
-   con = get_con_reg(data, readl(data->base + reg->tmu_ctrl));
-
-   if (on) {
-   con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
-   interrupt_en =
-   pdata->trigger_enable[3] << reg->inten_rise3_shift |
-   pdata->trigger_enable[2] << reg->inten_rise2_shift |
-   pdata->trigger_enable[1] << reg->inten_rise1_shift |
-   pdata->trigger_enable[0] << reg->inten_rise0_shift;
-   if (TMU_SUPPORTS(pdata, FALLING_TRIP))
-   interrupt_en |=
-   interrupt_en << reg->inten_fall0_shift;
-   } else {
-   con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
-   interrupt_en = 0; /* Disable all interrupts */
-   }
-   writel(interrupt_en, data->base + reg->tmu_inten);
-   writel(con, data->base + reg->tmu_ctrl);
-
+   data->tmu_control(pdev, on);
clk_disable(data->clk);
mutex_unlock(&data->lock);
 }
@@ -388,6 +368,58 @@ static int exynos5440_tmu_initialize(struct 
platform_device *pdev)
return ret;
 }
 
+static void exynos4210_tmu_control(struct platform_device *pdev, bool on)
+{
+   struct exynos_tmu_data *data = platform_get_drvdata(pdev);
+   struct exynos_tmu_platform_data *pdata = data->pdata;
+   unsigned int con, interrupt_en;
+
+   con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
+
+   if (on) {
+   con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
+   interrupt_en =
+   pdata->trigger_enable[3] << 
EXYNOS_TMU_INTEN_RISE3_SHIFT |
+   pdata->trigger_enable[2] << 
EXYNOS_TMU_INTEN_RISE2_SHIFT |
+   pdata->trigger_enable[1] << 
EXYNOS_TMU_INTEN_RISE1_SHIFT |
+   pdata->trigger_enable[0] << 
EXYNOS_TMU_INTEN_RISE0_SHIFT;
+   if (TMU_SUPPORTS(pdata, FALLING_TRIP))
+   interrupt_en |=
+   interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;
+   } else {
+   con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
+   interrupt_en = 0; /* Disable all interrupts */
+   }
+   writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN);
+   writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
+}
+
+static void exynos5440_tmu_control(struct platform_device *pdev, bool on)
+{
+   struct exynos_tmu_data *data = platform_get_drvdata(pdev);
+   struct exynos_tmu_platform_data *pdata = data->pdata;
+   unsigned int con, interrupt_en;
+
+   con = get_con_reg(data, readl(data->base + EXYNOS5440_TMU_S0_7_CTRL));
+
+   if (on) {
+   con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
+   interrupt_en =
+   pdata->trigger_enable[3] << 
EXYNOS5440_TMU_INTEN_RISE3_SHIFT |
+   pdata->trigger_enable[2] << 
EXYNOS5440_TMU_INTEN_RISE2_SHIFT |
+   pdata->trigger_enable[1] << 

[PATCH v2 23/33] thermal: exynos: add ->tmu_set_emulation method

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Add ->tmu_set_emulation method to struct exynos_tmu_data and
use it in exynos_tmu_set_emulation().  Then add ->tmu_set_emulation
implementations for Exynos4412+ and Exynos5440.  Finally remove
no longer needed reg->emul_con abstraction.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 41 +--
 drivers/thermal/samsung/exynos_tmu.h  |  2 --
 drivers/thermal/samsung/exynos_tmu_data.c |  5 
 3 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 1b622ce..01aa548 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -55,6 +55,7 @@
  * @tmu_initialize: SoC specific TMU initialization method
  * @tmu_control: SoC specific TMU control method
  * @tmu_read: SoC specific TMU temperature read method
+ * @tmu_set_emulation: SoC specific TMU emulation setting method
  */
 struct exynos_tmu_data {
int id;
@@ -72,6 +73,8 @@ struct exynos_tmu_data {
int (*tmu_initialize)(struct platform_device *pdev);
void (*tmu_control)(struct platform_device *pdev, bool on);
int (*tmu_read)(struct exynos_tmu_data *data);
+   void (*tmu_set_emulation)(struct exynos_tmu_data *data,
+ unsigned long temp);
 };
 
 /*
@@ -460,12 +463,36 @@ static u32 get_emul_con_reg(struct exynos_tmu_data *data, 
unsigned int val,
return val;
 }
 
+static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data,
+unsigned long temp)
+{
+   unsigned int val;
+   u32 emul_con;
+
+   if (data->soc == SOC_ARCH_EXYNOS5260)
+   emul_con = EXYNOS5260_EMUL_CON;
+   else
+   emul_con = EXYNOS_EMUL_CON;
+
+   val = readl(data->base + emul_con);
+   val = get_emul_con_reg(data, val, temp);
+   writel(val, data->base + emul_con);
+}
+
+static void exynos5440_tmu_set_emulation(struct exynos_tmu_data *data,
+unsigned long temp)
+{
+   unsigned int val;
+
+   val = readl(data->base + EXYNOS5440_TMU_S0_7_DEBUG);
+   val = get_emul_con_reg(data, val, temp);
+   writel(val, data->base + EXYNOS5440_TMU_S0_7_DEBUG);
+}
+
 static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
 {
struct exynos_tmu_data *data = drv_data;
struct exynos_tmu_platform_data *pdata = data->pdata;
-   const struct exynos_tmu_registers *reg = pdata->registers;
-   unsigned int val;
int ret = -EINVAL;
 
if (!TMU_SUPPORTS(pdata, EMULATION))
@@ -476,11 +503,7 @@ static int exynos_tmu_set_emulation(void *drv_data, 
unsigned long temp)
 
mutex_lock(&data->lock);
clk_enable(data->clk);
-
-   val = readl(data->base + reg->emul_con);
-   val = get_emul_con_reg(data, val, temp);
-   writel(val, data->base + reg->emul_con);
-
+   data->tmu_set_emulation(data, temp);
clk_disable(data->clk);
mutex_unlock(&data->lock);
return 0;
@@ -488,6 +511,8 @@ out:
return ret;
 }
 #else
+#define exynos4412_tmu_set_emulation NULL
+#define exynos5440_tmu_set_emulation NULL
 static int exynos_tmu_set_emulation(void *drv_data,unsigned long temp)
{ return -EINVAL; }
 #endif/*CONFIG_THERMAL_EMULATION*/
@@ -745,11 +770,13 @@ static int exynos_tmu_probe(struct platform_device *pdev)
data->tmu_initialize = exynos4412_tmu_initialize;
data->tmu_control = exynos4210_tmu_control;
data->tmu_read = exynos4412_tmu_read;
+   data->tmu_set_emulation = exynos4412_tmu_set_emulation;
break;
case SOC_ARCH_EXYNOS5440:
data->tmu_initialize = exynos5440_tmu_initialize;
data->tmu_control = exynos5440_tmu_control;
data->tmu_read = exynos5440_tmu_read;
+   data->tmu_set_emulation = exynos5440_tmu_set_emulation;
break;
default:
ret = -EINVAL;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 9460e6e..785eccf 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -72,12 +72,10 @@ enum soc_type {
  * The register validity may vary slightly across different exynos SOC's.
  * @tmu_intstat: Register containing the interrupt status values.
  * @tmu_intclear: Register for clearing the raised interrupt status.
- * @emul_con: TMU emulation controller register.
  */
 struct exynos_tmu_registers {
u32 tmu_intstat;
u32 tmu_intclear;
-   u32 emul_con;
 };
 
 /**
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung

[PATCH v2 29/33] thermal: exynos: remove TMU_SUPPORT_MULTI_INST flag

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Remove unused TMU_SUPPORT_MULTI_INST flag, no longer
needed TMU_SUPPORTS() macro and features field from
struct exynos_tmu_platform_data.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.h  | 13 -
 drivers/thermal/samsung/exynos_tmu_data.c |  3 +--
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 54f018d..2eb4cb9 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -46,16 +46,6 @@ enum soc_type {
 };
 
 /**
- * EXYNOS TMU supported features.
- * TMU_SUPPORT_MULTI_INST - This features denotes that the soc
- * has many instances of TMU.
- * TMU_SUPPORT - macro to compare the above features with the supplied.
- */
-#define TMU_SUPPORT_MULTI_INST BIT(0)
-
-#define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
-
-/**
  * struct exynos_tmu_platform_data
  * @threshold: basic temperature for generating interrupt
  *25 <= threshold <= 125 [unit: degree Celsius]
@@ -104,8 +94,6 @@ enum soc_type {
  * @freq_clip_table: Table representing frequency reduction percentage.
  * @freq_tab_count: Count of the above table as frequency reduction may
  * applicable to only some of the trigger levels.
- * @features: a bitfield value indicating the features supported in SOC like
- * emulation, multi instance etc
  *
  * This structure is required for configuration of exynos_tmu driver.
  */
@@ -133,7 +121,6 @@ struct exynos_tmu_platform_data {
enum soc_type type;
struct freq_clip_table freq_tab[4];
unsigned int freq_tab_count;
-   unsigned int features;
 };
 
 /**
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 13ac00b..d90b050 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -308,8 +308,7 @@ struct exynos_tmu_init_data const 
exynos5420_default_tmu_data = {
.first_point_trim = 25, \
.second_point_trim = 70, \
.default_temp_offset = 25, \
-   .type = SOC_ARCH_EXYNOS5440, \
-   .features = TMU_SUPPORT_MULTI_INST,
+   .type = SOC_ARCH_EXYNOS5440
 
 struct exynos_tmu_init_data const exynos5440_default_tmu_data = {
.tmu_data = {
-- 
1.8.2.3

--
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 v2 33/33] thermal: exynos: remove exynos_tmu_data.h include

2014-11-13 Thread Bartlomiej Zolnierkiewicz
There is no longer need to share defines between exynos_tmu.c
and exynos_tmu_data.c (as they are now only used by the former
file) so move them accordingly.  Then move externs for struct
exynos_tmu_init_data instances to exynos_tmu.h and remove no
longer needed exynos_tmu_data.h include.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  |  82 -
 drivers/thermal/samsung/exynos_tmu.h  |   8 +++
 drivers/thermal/samsung/exynos_tmu_data.c |   1 -
 drivers/thermal/samsung/exynos_tmu_data.h | 115 --
 4 files changed, 89 insertions(+), 117 deletions(-)
 delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.h

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 6cc6b6e..2a1c4c7 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -33,7 +33,87 @@
 
 #include "exynos_thermal_common.h"
 #include "exynos_tmu.h"
-#include "exynos_tmu_data.h"
+
+/* Exynos generic registers */
+#define EXYNOS_TMU_REG_TRIMINFO0x0
+#define EXYNOS_TMU_REG_CONTROL 0x20
+#define EXYNOS_TMU_REG_STATUS  0x28
+#define EXYNOS_TMU_REG_CURRENT_TEMP0x40
+#define EXYNOS_TMU_REG_INTEN   0x70
+#define EXYNOS_TMU_REG_INTSTAT 0x74
+#define EXYNOS_TMU_REG_INTCLEAR0x78
+
+#define EXYNOS_TMU_TEMP_MASK   0xff
+#define EXYNOS_TMU_REF_VOLTAGE_SHIFT   24
+#define EXYNOS_TMU_REF_VOLTAGE_MASK0x1f
+#define EXYNOS_TMU_BUF_SLOPE_SEL_MASK  0xf
+#define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8
+#define EXYNOS_TMU_CORE_EN_SHIFT   0
+
+/* Exynos3250 specific registers */
+#define EXYNOS_TMU_TRIMINFO_CON1   0x10
+
+/* Exynos4210 specific registers */
+#define EXYNOS4210_TMU_REG_THRESHOLD_TEMP  0x44
+#define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50
+
+/* Exynos5250, Exynos4412, Exynos3250 specific registers */
+#define EXYNOS_TMU_TRIMINFO_CON2   0x14
+#define EXYNOS_THD_TEMP_RISE   0x50
+#define EXYNOS_THD_TEMP_FALL   0x54
+#define EXYNOS_EMUL_CON0x80
+
+#define EXYNOS_TRIMINFO_RELOAD_ENABLE  1
+#define EXYNOS_TRIMINFO_25_SHIFT   0
+#define EXYNOS_TRIMINFO_85_SHIFT   8
+#define EXYNOS_TMU_TRIP_MODE_SHIFT 13
+#define EXYNOS_TMU_TRIP_MODE_MASK  0x7
+#define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12
+
+#define EXYNOS_TMU_INTEN_RISE0_SHIFT   0
+#define EXYNOS_TMU_INTEN_RISE1_SHIFT   4
+#define EXYNOS_TMU_INTEN_RISE2_SHIFT   8
+#define EXYNOS_TMU_INTEN_RISE3_SHIFT   12
+#define EXYNOS_TMU_INTEN_FALL0_SHIFT   16
+
+#define EXYNOS_EMUL_TIME   0x57F0
+#define EXYNOS_EMUL_TIME_MASK  0x
+#define EXYNOS_EMUL_TIME_SHIFT 16
+#define EXYNOS_EMUL_DATA_SHIFT 8
+#define EXYNOS_EMUL_DATA_MASK  0xFF
+#define EXYNOS_EMUL_ENABLE 0x1
+
+/* Exynos5260 specific */
+#define EXYNOS5260_TMU_REG_INTEN   0xC0
+#define EXYNOS5260_TMU_REG_INTSTAT 0xC4
+#define EXYNOS5260_TMU_REG_INTCLEAR0xC8
+#define EXYNOS5260_EMUL_CON0x100
+
+/* Exynos4412 specific */
+#define EXYNOS4412_MUX_ADDR_VALUE  6
+#define EXYNOS4412_MUX_ADDR_SHIFT  20
+
+/*exynos5440 specific registers*/
+#define EXYNOS5440_TMU_S0_7_TRIM   0x000
+#define EXYNOS5440_TMU_S0_7_CTRL   0x020
+#define EXYNOS5440_TMU_S0_7_DEBUG  0x040
+#define EXYNOS5440_TMU_S0_7_TEMP   0x0f0
+#define EXYNOS5440_TMU_S0_7_TH00x110
+#define EXYNOS5440_TMU_S0_7_TH10x130
+#define EXYNOS5440_TMU_S0_7_TH20x150
+#define EXYNOS5440_TMU_S0_7_IRQEN  0x210
+#define EXYNOS5440_TMU_S0_7_IRQ0x230
+/* exynos5440 common registers */
+#define EXYNOS5440_TMU_IRQ_STATUS  0x000
+#define EXYNOS5440_TMU_PMIN0x004
+
+#define EXYNOS5440_TMU_INTEN_RISE0_SHIFT   0
+#define EXYNOS5440_TMU_INTEN_RISE1_SHIFT   1
+#define EXYNOS5440_TMU_INTEN_RISE2_SHIFT   2
+#define EXYNOS5440_TMU_INTEN_RISE3_SHIFT   3
+#define EXYNOS5440_TMU_INTEN_FALL0_SHIFT   4
+#define EXYNOS5440_TMU_TH_RISE4_SHIFT  24
+#define EXYNOS5440_EFUSE_SWAP_OFFSET   8
 
 /**
  * struct exynos_tmu_data : A structure to hold the private data of the TMU
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 8de0f82..da3009b 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -133,4 +133,12 @@ struct exynos_tmu_init_data {
struct exynos_tmu_platform_data tmu_data[];
 };
 
+extern struct exynos_tmu_init_data const exynos3250_default_tmu_data;
+extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
+extern struct exynos_tmu_init_data const exynos4412_default_tmu

[PATCH v2 31/33] thermal: exynos: remove SoC type ifdefs

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Maximum theoretical size saving (i.e. with only Exynos5410
SoC support enabled in kernel config so all SoC dependend
Exynos thermal driver code was dropped) is 4096 bytes so
there is no much sense in keeping these ifdefs (especially
given that they are useless once the driver gets updated to
use device tree).

While at it remove needless 'void *' casts.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 16 ++--
 drivers/thermal/samsung/exynos_tmu_data.c | 18 --
 drivers/thermal/samsung/exynos_tmu_data.h | 41 ---
 3 files changed, 8 insertions(+), 67 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 2fcb4cd..6cc6b6e 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -593,35 +593,35 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id)
 static const struct of_device_id exynos_tmu_match[] = {
{
.compatible = "samsung,exynos3250-tmu",
-   .data = (void *)EXYNOS3250_TMU_DRV_DATA,
+   .data = &exynos3250_default_tmu_data,
},
{
.compatible = "samsung,exynos4210-tmu",
-   .data = (void *)EXYNOS4210_TMU_DRV_DATA,
+   .data = &exynos4210_default_tmu_data,
},
{
.compatible = "samsung,exynos4412-tmu",
-   .data = (void *)EXYNOS4412_TMU_DRV_DATA,
+   .data = &exynos4412_default_tmu_data,
},
{
.compatible = "samsung,exynos5250-tmu",
-   .data = (void *)EXYNOS5250_TMU_DRV_DATA,
+   .data = &exynos5250_default_tmu_data,
},
{
.compatible = "samsung,exynos5260-tmu",
-   .data = (void *)EXYNOS5260_TMU_DRV_DATA,
+   .data = &exynos5260_default_tmu_data,
},
{
.compatible = "samsung,exynos5420-tmu",
-   .data = (void *)EXYNOS5420_TMU_DRV_DATA,
+   .data = &exynos5420_default_tmu_data,
},
{
.compatible = "samsung,exynos5420-tmu-ext-triminfo",
-   .data = (void *)EXYNOS5420_TMU_DRV_DATA,
+   .data = &exynos5420_default_tmu_data,
},
{
.compatible = "samsung,exynos5440-tmu",
-   .data = (void *)EXYNOS5440_TMU_DRV_DATA,
+   .data = &exynos5440_default_tmu_data,
},
{},
 };
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 708c3e1..02a1c34 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -24,7 +24,6 @@
 #include "exynos_tmu.h"
 #include "exynos_tmu_data.h"
 
-#if defined(CONFIG_CPU_EXYNOS4210)
 struct exynos_tmu_init_data const exynos4210_default_tmu_data = {
.tmu_data = {
{
@@ -63,9 +62,7 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data 
= {
},
.tmu_count = 1,
 };
-#endif
 
-#if defined(CONFIG_SOC_EXYNOS3250)
 #define EXYNOS3250_TMU_DATA \
.threshold_falling = 10, \
.trigger_levels[0] = 70, \
@@ -101,9 +98,7 @@ struct exynos_tmu_init_data const 
exynos4210_default_tmu_data = {
.temp_level = 95, \
}, \
.freq_tab_count = 2
-#endif
 
-#if defined(CONFIG_SOC_EXYNOS3250)
 struct exynos_tmu_init_data const exynos3250_default_tmu_data = {
.tmu_data = {
{
@@ -113,9 +108,7 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
},
.tmu_count = 1,
 };
-#endif
 
-#if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250)
 #define EXYNOS4412_TMU_DATA \
.threshold_falling = 10, \
.trigger_levels[0] = 70, \
@@ -151,9 +144,7 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
.temp_level = 95, \
}, \
.freq_tab_count = 2
-#endif
 
-#if defined(CONFIG_SOC_EXYNOS4412)
 struct exynos_tmu_init_data const exynos4412_default_tmu_data = {
.tmu_data = {
{
@@ -163,9 +154,7 @@ struct exynos_tmu_init_data const 
exynos4412_default_tmu_data = {
},
.tmu_count = 1,
 };
-#endif
 
-#if defined(CONFIG_SOC_EXYNOS5250)
 struct exynos_tmu_init_data const exynos5250_default_tmu_data = {
.tmu_data = {
{
@@ -175,9 +164,7 @@ struct exynos_tmu_init_data const 
exynos5250_default_tmu_data = {
},
.tmu_count = 1,
 };
-#endif
 
-#if defined(CONFIG_SOC_EXYNOS5260)
 #define __EXYNOS5260_TMU_DATA  \
.threshold_falling = 10, \
.trigger_levels[0] = 85, \
@@ -228,9 +215,7 @@ struct exynos_tmu_init_data const 
exynos5260_default_tmu_data = {
   

[PATCH v2 30/33] thermal: exynos: remove test_mux pdata field

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Replace pdata->test_mux check in get_con_reg() by explicitly
checking for SoC type.

Also since the used pdata->test_mux value is always identical
use it directly and remove pdata->test_mux completely.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 5 +++--
 drivers/thermal/samsung/exynos_tmu.h  | 2 --
 drivers/thermal/samsung/exynos_tmu_data.c | 2 --
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 65eeecc..2fcb4cd 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -193,8 +193,9 @@ static u32 get_con_reg(struct exynos_tmu_data *data, u32 
con)
 {
struct exynos_tmu_platform_data *pdata = data->pdata;
 
-   if (pdata->test_mux)
-   con |= (pdata->test_mux << EXYNOS4412_MUX_ADDR_SHIFT);
+   if (data->soc == SOC_ARCH_EXYNOS4412 ||
+   data->soc == SOC_ARCH_EXYNOS3250)
+   con |= (EXYNOS4412_MUX_ADDR_VALUE << EXYNOS4412_MUX_ADDR_SHIFT);
 
con &= ~(EXYNOS_TMU_REF_VOLTAGE_MASK << EXYNOS_TMU_REF_VOLTAGE_SHIFT);
con |= pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 2eb4cb9..8de0f82 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -89,7 +89,6 @@ enum soc_type {
  * @first_point_trim: temp value of the first point trimming
  * @second_point_trim: temp value of the second point trimming
  * @default_temp_offset: default temperature offset in case of no trimming
- * @test_mux; information if SoC supports test MUX
  * @cal_type: calibration type for temperature
  * @freq_clip_table: Table representing frequency reduction percentage.
  * @freq_tab_count: Count of the above table as frequency reduction may
@@ -115,7 +114,6 @@ struct exynos_tmu_platform_data {
u8 first_point_trim;
u8 second_point_trim;
u8 default_temp_offset;
-   u8 test_mux;
 
enum calibration_type cal_type;
enum soc_type type;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index d90b050..708c3e1 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -109,7 +109,6 @@ struct exynos_tmu_init_data const 
exynos3250_default_tmu_data = {
{
EXYNOS3250_TMU_DATA,
.type = SOC_ARCH_EXYNOS3250,
-   .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
},
},
.tmu_count = 1,
@@ -160,7 +159,6 @@ struct exynos_tmu_init_data const 
exynos4412_default_tmu_data = {
{
EXYNOS4412_TMU_DATA,
.type = SOC_ARCH_EXYNOS4412,
-   .test_mux = EXYNOS4412_MUX_ADDR_VALUE,
},
},
.tmu_count = 1,
-- 
1.8.2.3

--
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 v2 32/33] thermal: exynos: remove __EXYNOS5420_TMU_DATA macro

2014-11-13 Thread Bartlomiej Zolnierkiewicz
__EXYNOS5420_TMU_DATA macro is now identical to __EXYNOS5260_TMU_DATA
one and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu_data.c | 40 ++-
 1 file changed, 2 insertions(+), 38 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index 02a1c34..592c470 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -216,48 +216,12 @@ struct exynos_tmu_init_data const 
exynos5260_default_tmu_data = {
.tmu_count = 5,
 };
 
-#define __EXYNOS5420_TMU_DATA  \
-   .threshold_falling = 10, \
-   .trigger_levels[0] = 85, \
-   .trigger_levels[1] = 103, \
-   .trigger_levels[2] = 110, \
-   .trigger_levels[3] = 120, \
-   .trigger_enable[0] = true, \
-   .trigger_enable[1] = true, \
-   .trigger_enable[2] = true, \
-   .trigger_enable[3] = false, \
-   .trigger_type[0] = THROTTLE_ACTIVE, \
-   .trigger_type[1] = THROTTLE_ACTIVE, \
-   .trigger_type[2] = SW_TRIP, \
-   .trigger_type[3] = HW_TRIP, \
-   .max_trigger_level = 4, \
-   .non_hw_trigger_levels = 3, \
-   .gain = 8, \
-   .reference_voltage = 16, \
-   .noise_cancel_mode = 4, \
-   .cal_type = TYPE_ONE_POINT_TRIMMING, \
-   .efuse_value = 55, \
-   .min_efuse_value = 40, \
-   .max_efuse_value = 100, \
-   .first_point_trim = 25, \
-   .second_point_trim = 85, \
-   .default_temp_offset = 50, \
-   .freq_tab[0] = { \
-   .freq_clip_max = 800 * 1000, \
-   .temp_level = 85, \
-   }, \
-   .freq_tab[1] = { \
-   .freq_clip_max = 200 * 1000, \
-   .temp_level = 103, \
-   }, \
-   .freq_tab_count = 2, \
-
 #define EXYNOS5420_TMU_DATA \
-   __EXYNOS5420_TMU_DATA \
+   __EXYNOS5260_TMU_DATA \
.type = SOC_ARCH_EXYNOS5420
 
 #define EXYNOS5420_TMU_DATA_SHARED \
-   __EXYNOS5420_TMU_DATA \
+   __EXYNOS5260_TMU_DATA \
.type = SOC_ARCH_EXYNOS5420_TRIMINFO
 
 struct exynos_tmu_init_data const exynos5420_default_tmu_data = {
-- 
1.8.2.3

--
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 v2 12/33] thermal: exynos: simplify HW_TRIP level setting

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Simplify HW_TRIP level setting in exynos_tmu_initialize() (don't
pretend that the current code is hardware and configuration
independent and just do SoC type check explicitly).  Then remove
no longer needed reg->threshold_[th2,th3_l0_shift] abstractions
(only assigned for Exynos5440 in exynos5440_tmu_registers) and
EXYNOS_MAX_TRIGGER_PER_REG define.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 10 +-
 drivers/thermal/samsung/exynos_tmu.h  |  4 
 drivers/thermal/samsung/exynos_tmu_data.c |  2 --
 drivers/thermal/samsung/exynos_tmu_data.h |  2 --
 4 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index 411c465..1c15b37 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -252,18 +252,18 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
(pdata->trigger_type[i] == HW_TRIP)) {
threshold_code = temp_to_code(data,
pdata->trigger_levels[i]);
-   if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) {
+   if (data->soc != SOC_ARCH_EXYNOS5440) {
/* 1-4 level to be assigned in th0 reg */
rising_threshold &= ~(0xff << 8 * i);
rising_threshold |= threshold_code << 8 * i;
writel(rising_threshold,
-   data->base + reg->threshold_th0);
-   } else if (i == EXYNOS_MAX_TRIGGER_PER_REG) {
+   data->base + EXYNOS_THD_TEMP_RISE);
+   } else {
/* 5th level to be assigned in th2 reg */
rising_threshold =
-   threshold_code << reg->threshold_th3_l0_shift;
+   threshold_code << EXYNOS5440_TMU_TH_RISE4_SHIFT;
writel(rising_threshold,
-   data->base + reg->threshold_th2);
+   data->base + EXYNOS5440_TMU_S0_7_TH2);
}
con = readl(data->base + reg->tmu_ctrl);
con |= (1 << EXYNOS_TMU_THERM_TRIP_EN_SHIFT);
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index e8510aa..ebe39b4 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -80,8 +80,6 @@ enum soc_type {
  * @tmu_cur_temp: register containing the current temperature of the TMU.
  * @threshold_th0: Register containing first set of rising levels.
  * @threshold_th1: Register containing second set of rising levels.
- * @threshold_th2: Register containing third set of rising levels.
- * @threshold_th3_l0_shift: shift bits of level0 threshold temperature.
  * @tmu_inten: register containing the different threshold interrupt
enable bits.
  * @inten_rise0_shift: shift bits of rising 0 interrupt bits.
@@ -100,8 +98,6 @@ struct exynos_tmu_registers {
 
u32 threshold_th0;
u32 threshold_th1;
-   u32 threshold_th2;
-   u32 threshold_th3_l0_shift;
 
u32 tmu_inten;
u32 inten_rise0_shift;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index fe063d4..f81c940 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -391,8 +391,6 @@ static const struct exynos_tmu_registers 
exynos5440_tmu_registers = {
.tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP,
.threshold_th0 = EXYNOS5440_TMU_S0_7_TH0,
.threshold_th1 = EXYNOS5440_TMU_S0_7_TH1,
-   .threshold_th2 = EXYNOS5440_TMU_S0_7_TH2,
-   .threshold_th3_l0_shift = EXYNOS5440_TMU_TH_RISE4_SHIFT,
.tmu_inten = EXYNOS5440_TMU_S0_7_IRQEN,
.inten_rise0_shift = EXYNOS5440_TMU_INTEN_RISE0_SHIFT,
.inten_rise1_shift = EXYNOS5440_TMU_INTEN_RISE1_SHIFT,
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h 
b/drivers/thermal/samsung/exynos_tmu_data.h
index e02ef99..2af312d 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.h
+++ b/drivers/thermal/samsung/exynos_tmu_data.h
@@ -72,8 +72,6 @@
 #define EXYNOS_EMUL_DATA_MASK  0xFF
 #define EXYNOS_EMUL_ENABLE 0x1
 
-#define EXYNOS_MAX_TRIGGER_PER_REG 4
-
 /* Exynos5260 specific */
 #define EXYNOS5260_TMU_REG_INTEN   0xC0
 #define EXYNOS5260_TMU_REG_INTSTAT 0xC4
-- 
1.8.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the bo

[PATCH v2 02/33] thermal: exynos: remove needless tmu_status abstraction

2014-11-13 Thread Bartlomiej Zolnierkiewicz
reg->tmu_status is used only in exynos_tmu_initialize() and it
is accessed only if TMU_SUPPORT_READY_STATUS flag is set.  This
flag is not set for Exynos5440 and TMU_STATUS register offset
is identical for all other SoC types so the abstraction is not
needed and can be removed.

There should be no functional changes caused by this patch.

Cc: Amit Daniel Kachhap 
Cc: Lukasz Majewski 
Cc: Eduardo Valentin 
Cc: Zhang Rui 
Signed-off-by: Bartlomiej Zolnierkiewicz 
Acked-by: Kyungmin Park 
---
 drivers/thermal/samsung/exynos_tmu.c  | 2 +-
 drivers/thermal/samsung/exynos_tmu.h  | 3 ---
 drivers/thermal/samsung/exynos_tmu_data.c | 6 --
 drivers/thermal/samsung/exynos_tmu_data.h | 1 -
 4 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c 
b/drivers/thermal/samsung/exynos_tmu.c
index bb05355..ac43637 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -154,7 +154,7 @@ static int exynos_tmu_initialize(struct platform_device 
*pdev)
clk_enable(data->clk_sec);
 
if (TMU_SUPPORTS(pdata, READY_STATUS)) {
-   status = readb(data->base + reg->tmu_status);
+   status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status) {
ret = -EBUSY;
goto out;
diff --git a/drivers/thermal/samsung/exynos_tmu.h 
b/drivers/thermal/samsung/exynos_tmu.h
index 91e2317..7849d8f 100644
--- a/drivers/thermal/samsung/exynos_tmu.h
+++ b/drivers/thermal/samsung/exynos_tmu.h
@@ -83,7 +83,6 @@ enum soc_type {
  * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register.
  * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register.
  * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register.
- * @tmu_status: register drescribing the TMU status.
  * @tmu_cur_temp: register containing the current temperature of the TMU.
  * @threshold_temp: register containing the base threshold level.
  * @threshold_th0: Register containing first set of rising levels.
@@ -115,8 +114,6 @@ struct exynos_tmu_registers {
u32 therm_trip_mode_mask;
u32 therm_trip_en_shift;
 
-   u32 tmu_status;
-
u32 tmu_cur_temp;
 
u32 threshold_temp;
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c 
b/drivers/thermal/samsung/exynos_tmu_data.c
index a6088ff..49c8142 100644
--- a/drivers/thermal/samsung/exynos_tmu_data.c
+++ b/drivers/thermal/samsung/exynos_tmu_data.c
@@ -27,7 +27,6 @@
 #if defined(CONFIG_CPU_EXYNOS4210)
 static const struct exynos_tmu_registers exynos4210_tmu_registers = {
.tmu_ctrl = EXYNOS_TMU_REG_CONTROL,
-   .tmu_status = EXYNOS_TMU_REG_STATUS,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP,
.threshold_th0 = EXYNOS4210_TMU_REG_TRIG_LEVEL0,
@@ -92,7 +91,6 @@ static const struct exynos_tmu_registers 
exynos3250_tmu_registers = {
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
-   .tmu_status = EXYNOS_TMU_REG_STATUS,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -173,7 +171,6 @@ static const struct exynos_tmu_registers 
exynos4412_tmu_registers = {
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
-   .tmu_status = EXYNOS_TMU_REG_STATUS,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -263,7 +260,6 @@ static const struct exynos_tmu_registers 
exynos5260_tmu_registers = {
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
-   .tmu_status = EXYNOS_TMU_REG_STATUS,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -341,7 +337,6 @@ static const struct exynos_tmu_registers 
exynos5420_tmu_registers = {
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK,
.therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT,
-   .tmu_status = EXYNOS_TMU_REG_STATUS,
.tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP,
.threshold_th0 = EXYNOS_THD_TEMP_RISE,
.threshold_th1 = EXYNOS_THD_TEMP_FALL,
@@ -427,7 +422,6 @@ static const struct exynos_tmu_registers 
exynos5440_tmu_registers = {
.therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT,
.therm_trip_mode_mask = EXYNOS_TMU_TRIP_MO

[PATCH v2 00/33] thermal: exynos: convert the driver to use per-SoC type operations

2014-11-13 Thread Bartlomiej Zolnierkiewicz
Hi,

This patch series replaces the hardware registers abstractions in
the Exynos thermal driver by the usage of per-SoC type operations.
Such solution provides simpler, easier to understand code and
allows removal of ~250 LOCs (~11% of the whole source code) from
the driver.  Some other driver improvements are now also possible
thanks to these changes but are scheduled at later time (like
consolidating code for clearing IRQs using INTCLEAR register).

The patchset should not cause any functionality changes.  This
means that unless there are some bugs in the patches itself there
should be no behavior changes for the driver (this also includes
lack of changes in the way hardware is accessed by the driver).

All testing was done on (Exynos4412 SoC based) ODROID U3 board
(some additional patches are needed to make the Exynos thermal
driver work on this hardware).

Depends on:
- 'next' branch of linux-soc-thermal.git kernel tree from Eduardo

Changes since v1 (https://lkml.org/lkml/2014/9/18/305):
- rebased on top of the current linux-soc-thermal kernel

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (33):
  thermal: exynos: remove needless triminfo_data abstraction
  thermal: exynos: remove needless tmu_status abstraction
  thermal: exynos: remove needless threshold_temp abstraction
  thermal: exynos: remove needless triminfo_ctrl abstraction
  thermal: exynos: remove needless test_mux_addr_shift abstraction
  thermal: exynos: remove needless therm_trip_[mode,mask]_shift
abstractions
  thermal: exynos: remove needless therm_trip_en_shift abstraction
  thermal: exynos: remove needless emul_temp_shift abstraction
  thermal: exynos: remove needless emul_time_shift abstraction
  thermal: exynos: replace tmu_irqstatus check by Exynos5440 one
  thermal: exynos: replace tmu_pmin check by Exynos5440 one
  thermal: exynos: simplify HW_TRIP level setting
  thermal: exynos: replace threshold_falling check by Exynos SoC type
one
  thermal: exynos: remove TMU_SUPPORT_READY_STATUS flag
  thermal: exynos: remove TMU_SUPPORT_TRIM_RELOAD flag
  thermal: exynos: add sanitize_temp_error() helper
  thermal: exynos: add get_th_reg() helper
  thermal: exynos: add ->tmu_initialize method
  thermal: exynos: add get_con_reg() helper
  thermal: exynos: add ->tmu_control method
  thermal: exynos: add ->tmu_read method
  thermal: exynos: add get_emul_con_reg() helper
  thermal: exynos: add ->tmu_set_emulation method
  thermal: exynos: add ->tmu_clear_irqs method
  thermal: exynos: remove TMU_SUPPORT_FALLING_TRIP flag
  thermal: exynos: remove TMU_SUPPORT_EMUL_TIME flag
  thermal: exynos: remove TMU_SUPPORT_EMULATION flag
  thermal: exynos: remove TMU_SUPPORT_ADDRESS_MULTIPLE flag
  thermal: exynos: remove TMU_SUPPORT_MULTI_INST flag
  thermal: exynos: remove test_mux pdata field
  thermal: exynos: remove SoC type ifdefs
  thermal: exynos: remove __EXYNOS5420_TMU_DATA macro
  thermal: exynos: remove exynos_tmu_data.h include

 drivers/thermal/samsung/exynos_thermal_common.h |   1 -
 drivers/thermal/samsung/exynos_tmu.c| 692 
 drivers/thermal/samsung/exynos_tmu.h| 123 +
 drivers/thermal/samsung/exynos_tmu_data.c   | 239 +---
 drivers/thermal/samsung/exynos_tmu_data.h   | 159 --
 5 files changed, 485 insertions(+), 729 deletions(-)
 delete mode 100644 drivers/thermal/samsung/exynos_tmu_data.h

-- 
1.8.2.3

--
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 0/4] drm/exynos/dsi: remove global display variable

2014-11-13 Thread Andrzej Hajda
On 11/13/2014 09:50 AM, Inki Dae wrote:
> On 2014년 10월 07일 21:01, Andrzej Hajda wrote:
>> Hi Inki,
>>
>> Many Exynos DRM drivers uses global variables to represent associated devices
>> in Exynos DRM internal framework. It is quite confusing, it adds data 
>> duplication
>> and finally it does not allow to handle more than one device in system.
>> It seems better to embed such structures in private context of the device.
>>
>> The patchset is based on exynos_drm_next plus my patch [1]:
>> 'drm/exynos: remove explicit encoder/connector de-initialization'.
>>
>> If the patchset is OK for you I can prepare similar patches for other Exynos 
>> DRM components.
> Sorry for late. Applied. Can you prepare similar patches for other? If
> so, I'd happy.

Beginning of the next week is OK?

Regards
Andrzej

>
> Thanks,
> Inki Dae
>
>> [1]: https://lkml.org/lkml/2014/9/22/148
>>
>> Regards
>> Andrzej
>>
>>
>> Andrzej Hajda (4):
>>   drm/exynos/dsi: remove global variable exynos_dsi_display
>>   drm/exynos/dsi: simplify device pointer evaluation
>>   drm/exynos/dsi: remove redundant encoder field
>>   drm/exynos/dsi: stop using display->ctx pointer
>>
>>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 96 
>> -
>>  1 file changed, 47 insertions(+), 49 deletions(-)
>>
>

--
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 v3 0/9] PM / Domains: Fix race conditions during boot

2014-11-13 Thread Pavel Machek
Hi!

> 2) There are no requirements for arch/platforms/drivers to work in both cases
> CONFIG_PM_RUNTIME=y/n. But they must be built without errors/warning for both
> cases.

I don't think where you got that. They are config options, they should
work.

It is prefer not to compile than to compile but not work.
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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 v3] usb: dwc2/gadget: report disconnect event from 'end session' irq

2014-11-13 Thread Marek Szyprowski

Hello,

On 2014-10-31 19:15, Paul Zimmerman wrote:

From: Marek Szyprowski [mailto:m.szyprow...@samsung.com]
Sent: Friday, October 31, 2014 1:04 AM
To: linux-...@vger.kernel.org; linux-samsung-soc@vger.kernel.org
Cc: Marek Szyprowski; Kyungmin Park; Robert Baldyga; Paul Zimmerman; Krzysztof 
Kozlowski; Felipe Balbi
Subject: [PATCH v3] usb: dwc2/gadget: report disconnect event from 'end 
session' irq

This patch adds a call to s3c_hsotg_disconnect() from 'end session'
interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem
about unplugged usb cable. 'disconnected' interrupt (DISCONNINT) might
look a bit more suitable for this event, but it is asserted only in
host mode, so in device mode we need to use something else.

Additional check has been added in s3c_hsotg_disconnect() function
to ensure that the event is reported only once after successful device
enumeration.

Signed-off-by: Marek Szyprowski 
---
  drivers/usb/dwc2/core.h   |  1 +
  drivers/usb/dwc2/gadget.c | 10 ++
  2 files changed, 11 insertions(+)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 55c90c53f2d6..b42df32e7737 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -212,6 +212,7 @@ struct s3c_hsotg {
struct usb_gadget   gadget;
unsigned intsetup;
unsigned long   last_rst;
+   unsigned intaddress;
struct s3c_hsotg_ep *eps;
  };

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index fcd2bb55ccca..6304efba11aa 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -1114,6 +1114,7 @@ static void s3c_hsotg_process_control(struct s3c_hsotg 
*hsotg,
 DCFG_DEVADDR_SHIFT) & DCFG_DEVADDR_MASK;
writel(dcfg, hsotg->regs + DCFG);

+   hsotg->address = ctrl->wValue;
dev_info(hsotg->dev, "new address %d\n", ctrl->wValue);

ret = s3c_hsotg_send_reply(hsotg, ep0, NULL, 0);
@@ -2031,6 +2032,10 @@ static void s3c_hsotg_disconnect(struct s3c_hsotg *hsotg)
  {
unsigned ep;

+   if (!hsotg->address)
+   return;
+
+   hsotg->address = 0;
for (ep = 0; ep < hsotg->num_of_eps; ep++)
kill_all_requests(hsotg, &hsotg->eps[ep], -ESHUTDOWN, true);

@@ -2290,6 +2295,11 @@ irq_retry:
dev_info(hsotg->dev, "OTGInt: %08x\n", otgint);

writel(otgint, hsotg->regs + GOTGINT);
+
+   if (otgint & GOTGINT_SES_END_DET) {
+   s3c_hsotg_disconnect(hsotg);
+   hsotg->gadget.speed = USB_SPEED_UNKNOWN;
+   }
}

if (gintsts & GINTSTS_SESSREQINT) {

I don't think this is right. The host can send control requests to
the device before it sends a SetAddress to change from the default
address of 0. So if a GOTGINT_SES_END_DET happens before the
SetAddress, it will be ignored.

Or am I missing something?


Well, right. However before finishing enumeration (setting the address) 
host usually
only retrieves some usb descriptors what doesn't change the state of the 
gadget.
Right now we always reported 'disconnected' event before setting the new 
address,
what is a bit overkill (in some cases gadget driver got this even more 
than once).
The above code handles all cases correctly and reports disconnect event 
only once.


Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
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 v8 4/7] ARM: l2c: Add support for overriding prefetch settings

2014-11-13 Thread Marek Szyprowski
From: Tomasz Figa 

Firmware on certain boards (e.g. ODROID-U3) can leave incorrect L2C prefetch
settings configured in registers leading to crashes if L2C is enabled
without overriding them. This patch introduces bindings to enable
prefetch settings to be specified from DT and necessary support in the
driver.

Signed-off-by: Tomasz Figa 
[mszyprow: rebased onto v3.18-rc1, added error message when prefetch related
 dt property has been provided without any value]
Signed-off-by: Marek Szyprowski 
---
 Documentation/devicetree/bindings/arm/l2cc.txt | 10 +
 arch/arm/mm/cache-l2x0.c   | 54 ++
 2 files changed, 64 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt 
b/Documentation/devicetree/bindings/arm/l2cc.txt
index 292ef7ca3058..0dbabe9a6b0a 100644
--- a/Documentation/devicetree/bindings/arm/l2cc.txt
+++ b/Documentation/devicetree/bindings/arm/l2cc.txt
@@ -57,6 +57,16 @@ Optional properties:
 - cache-id-part: cache id part number to be used if it is not present
   on hardware
 - wt-override: If present then L2 is forced to Write through mode
+- arm,double-linefill : Override double linefill enable setting. Enable if
+  non-zero, disable if zero.
+- arm,double-linefill-incr : Override double linefill on INCR read. Enable
+  if non-zero, disable if zero.
+- arm,double-linefill-wrap : Override double linefill on WRAP read. Enable
+  if non-zero, disable if zero.
+- arm,prefetch-drop : Override prefetch drop enable setting. Enable if 
non-zero,
+  disable if zero.
+- arm,prefetch-offset : Override prefetch offset value. Valid values are
+  0-7, 15, 23, and 31.
 
 Example:
 
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index d214be207517..6f9d5a02d053 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -1169,6 +1169,8 @@ static void __init l2c310_of_parse(const struct 
device_node *np,
u32 tag[3] = { 0, 0, 0 };
u32 filter[2] = { 0, 0 };
u32 assoc;
+   u32 prefetch;
+   u32 val;
int ret;
 
of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
@@ -1214,6 +1216,58 @@ static void __init l2c310_of_parse(const struct 
device_node *np,
   assoc);
break;
}
+
+   prefetch = l2x0_saved_regs.prefetch_ctrl;
+
+   ret = of_property_read_u32(np, "arm,double-linefill", &val);
+   if (ret == 0) {
+   if (val)
+   prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL;
+   else
+   prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL;
+   } else if (ret != -EINVAL) {
+   pr_err("L2C-310 OF arm,double-linefill property value is 
missing\n");
+   }
+
+   ret = of_property_read_u32(np, "arm,double-linefill-incr", &val);
+   if (ret == 0) {
+   if (val)
+   prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_INCR;
+   else
+   prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_INCR;
+   } else if (ret != -EINVAL) {
+   pr_err("L2C-310 OF arm,double-linefill-incr property value is 
missing\n");
+   }
+
+   ret = of_property_read_u32(np, "arm,double-linefill-wrap", &val);
+   if (ret == 0) {
+   if (!val)
+   prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP;
+   else
+   prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP;
+   } else if (ret != -EINVAL) {
+   pr_err("L2C-310 OF arm,double-linefill-wrap property value is 
missing\n");
+   }
+
+   ret = of_property_read_u32(np, "arm,prefetch-drop", &val);
+   if (ret == 0) {
+   if (val)
+   prefetch |= L310_PREFETCH_CTRL_PREFETCH_DROP;
+   else
+   prefetch &= ~L310_PREFETCH_CTRL_PREFETCH_DROP;
+   } else if (ret != -EINVAL) {
+   pr_err("L2C-310 OF arm,prefetch-drop property value is 
missing\n");
+   }
+
+   ret = of_property_read_u32(np, "arm,prefetch-offset", &val);
+   if (ret == 0) {
+   prefetch &= ~L310_PREFETCH_CTRL_OFFSET_MASK;
+   prefetch |= val & L310_PREFETCH_CTRL_OFFSET_MASK;
+   } else if (ret != -EINVAL) {
+   pr_err("L2C-310 OF arm,prefetch-offset property value is 
missing\n");
+   }
+
+   l2x0_saved_regs.prefetch_ctrl = prefetch;
 }
 
 static const struct l2c_init_data of_l2c310_data __initconst = {
-- 
1.9.2

--
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 v8 5/7] ARM: EXYNOS: Add .write_sec outer cache callback for L2C-310

2014-11-13 Thread Marek Szyprowski
From: Tomasz Figa 

Exynos4 SoCs equipped with an L2C-310 cache controller and running under
secure firmware require certain registers of aforementioned IP to be
accessed only from secure mode. This means that SMC calls are required
for certain register writes. To handle this, an implementation of
.write_sec and .configure callbacks is provided by this patch.

Signed-off-by: Tomasz Figa 
[added comment and reworked unconditional call to SMC_CMD_L2X0INVALL]
Signed-off-by: Marek Szyprowski 
---
 arch/arm/mach-exynos/firmware.c | 50 +
 1 file changed, 50 insertions(+)

diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index 766f57d2f029..dc5ae53aa317 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -136,6 +137,43 @@ static const struct firmware_ops exynos_firmware_ops = {
.resume = IS_ENABLED(CONFIG_EXYNOS_CPU_SUSPEND) ? 
exynos_resume : NULL,
 };
 
+static void exynos_l2_write_sec(unsigned long val, unsigned reg)
+{
+   static int l2cache_enabled;
+
+   switch (reg) {
+   case L2X0_CTRL:
+   if (val & L2X0_CTRL_EN) {
+   /*
+* Before the cache can be enabled, due to firmware
+* design, SMC_CMD_L2X0INVALL must be called.
+*/
+   if (!l2cache_enabled) {
+   exynos_smc(SMC_CMD_L2X0INVALL, 0, 0, 0);
+   l2cache_enabled = 1;
+   }
+   } else {
+   l2cache_enabled = 0;
+   }
+   exynos_smc(SMC_CMD_L2X0CTRL, val, 0, 0);
+   break;
+
+   case L2X0_DEBUG_CTRL:
+   exynos_smc(SMC_CMD_L2X0DEBUG, val, 0, 0);
+   break;
+
+   default:
+   WARN_ONCE(1, "%s: ignoring write to reg 0x%x\n", __func__, reg);
+   }
+}
+
+static void exynos_l2_configure(const struct l2x0_regs *regs)
+{
+   exynos_smc(SMC_CMD_L2X0SETUP1, regs->tag_latency, regs->data_latency,
+   regs->prefetch_ctrl);
+   exynos_smc(SMC_CMD_L2X0SETUP2, regs->pwr_ctrl, regs->aux_ctrl, 0);
+}
+
 void __init exynos_firmware_init(void)
 {
struct device_node *nd;
@@ -155,4 +193,16 @@ void __init exynos_firmware_init(void)
pr_info("Running under secure firmware.\n");
 
register_firmware_ops(&exynos_firmware_ops);
+
+   /*
+* Exynos 4 SoCs (based on Cortex A9 and equipped with L2C-310),
+* running under secure firmware, require certain registers of L2
+* cache controller to be written in secure mode. Here .write_sec
+* callback is provided to perform necessary SMC calls.
+*/
+   if (IS_ENABLED(CONFIG_CACHE_L2X0)
+   && read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
+   outer_cache.write_sec = exynos_l2_write_sec;
+   outer_cache.configure = exynos_l2_configure;
+   }
 }
-- 
1.9.2

--
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 v8 0/7] Enable L2 cache support on Exynos4210/4x12 SoCs

2014-11-13 Thread Marek Szyprowski
This is an updated patchset, which intends to add support for L2 cache
on Exynos4 SoCs on boards running under secure firmware, which requires
certain initialization steps to be done with help of firmware, as
selected registers are writable only from secure mode.

First four patches extend existing support for secure write in L2C driver
to account for design of secure firmware running on Exynos. Namely:
 1) direct read access to certain registers is needed on Exynos, because
secure firmware calls set several registers at once,
 2) not all boards are running secure firmware, so .write_sec callback
needs to be installed in Exynos firmware ops initialization code,
 3) write access to {DATA,TAG}_LATENCY_CTRL registers fron non-secure world
is not allowed and so must use l2c_write_sec as well,
 4) on certain boards, default value of prefetch register is incorrect
and must be overridden at L2C initialization.
For boards running with firmware that provides access to individual
L2C registers this series should introduce no functional changes. However
since the driver is widely used on other platforms I'd like to kindly ask
any interested people for testing.

Further three patches add implementation of .write_sec and .configure
callbacks for Exynos secure firmware and necessary DT nodes to enable
L2 cache.

Changes in this version tested on Exynos4412-based TRATS2 and OdroidU3+
boards (both with secure firmware). There should be no functional change
for Exynos boards running without secure firmware. I do not have access
to affected non-Exynos boards, so I could not test on them.


Depends on:
 - [PATCH v3 0/5] Firmware-assisted suspend/resume of Exynos SoCs
   (https://lkml.org/lkml/2014/8/26/445)
   available in samsung/pm2 branch in
   git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
 - L2C patches merged to v3.18-rc3


Changelog:
Changes since v7:
(https://lkml.org/lkml/2014/10/29/158)
- rebased onto arm-soc/for-next kernel tree (depends on patches merged to
  v3.18-rc3 and arm-soc/samsung/pm2 branch)
- removed 'ARM: l2c: unify L2C-310 OF initialization error messages' patch
  (no longer needed)

Changes since v6:
(https://lkml.org/lkml/2014/10/27/233)
- changed PL310 to L2C-310 prefix in error messages
- added patch shortening the error message about incorrect associativity

Changes since v5:
(https://lkml.org/lkml/2014/9/24/364)
- rebased onto v3.18-rc2
- added error message about missing properties values

Changes since v4:
(https://lkml.org/lkml/2014/8/26/461)
 - rewrote the code accessing l2x0_saved_regs from assembly code
 - added comment and reworked unconditional call to SMC_CMD_L2X0INVALL


Patch summary:

Tomasz Figa (7):
  ARM: l2c: Refactor the driver to use commit-like interface
  ARM: l2c: Add interface to ask hypervisor to configure L2C
  ARM: l2c: Get outer cache .write_sec callback from mach_desc only if
not NULL
  ARM: l2c: Add support for overriding prefetch settings
  ARM: EXYNOS: Add .write_sec outer cache callback for L2C-310
  ARM: EXYNOS: Add support for non-secure L2X0 resume
  ARM: dts: exynos4: Add nodes for L2 cache controller

 Documentation/devicetree/bindings/arm/l2cc.txt |  10 +
 arch/arm/boot/dts/exynos4210.dtsi  |   9 +
 arch/arm/boot/dts/exynos4x12.dtsi  |  14 ++
 arch/arm/include/asm/outercache.h  |   3 +
 arch/arm/kernel/irq.c  |   3 +-
 arch/arm/mach-exynos/firmware.c|  50 +
 arch/arm/mach-exynos/sleep.S   |  46 +
 arch/arm/mm/cache-l2x0.c   | 270 -
 8 files changed, 309 insertions(+), 96 deletions(-)

-- 
1.9.2

--
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 v8 3/7] ARM: l2c: Get outer cache .write_sec callback from mach_desc only if not NULL

2014-11-13 Thread Marek Szyprowski
From: Tomasz Figa 

Certain platforms (i.e. Exynos) might need to set .write_sec callback
from firmware initialization which is happenning in .init_early callback
of machine descriptor. However current code will overwrite the pointer
with whatever is present in machine descriptor, even though it can be
already set earlier. This patch fixes this by making the assignment
conditional, depending on whether current .write_sec callback is NULL.

Signed-off-by: Tomasz Figa 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/kernel/irq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 7c81ec428b9b..5acb8aef6f2d 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -108,7 +108,8 @@ void __init init_IRQ(void)
 
if (IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_CACHE_L2X0) &&
(machine_desc->l2c_aux_mask || machine_desc->l2c_aux_val)) {
-   outer_cache.write_sec = machine_desc->l2c_write_sec;
+   if (!outer_cache.write_sec)
+   outer_cache.write_sec = machine_desc->l2c_write_sec;
ret = l2x0_of_init(machine_desc->l2c_aux_val,
   machine_desc->l2c_aux_mask);
if (ret)
-- 
1.9.2

--
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 v8 1/7] ARM: l2c: Refactor the driver to use commit-like interface

2014-11-13 Thread Marek Szyprowski
From: Tomasz Figa 

Certain implementations of secure hypervisors (namely the one found on
Samsung Exynos-based boards) do not provide access to individual L2C
registers. This makes the .write_sec()-based interface insufficient and
provoking ugly hacks.

This patch is first step to make the driver not rely on availability of
writes to individual registers. This is achieved by refactoring the
driver to use a commit-like operation scheme: all register values are
prepared first and stored in an instance of l2x0_regs struct and then a
single callback is responsible to flush those values to the hardware.

Signed-off-by: Tomasz Figa 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/mm/cache-l2x0.c | 210 ++-
 1 file changed, 115 insertions(+), 95 deletions(-)

diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 5e65ca8dea62..e5948c5adaa7 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -41,12 +41,14 @@ struct l2c_init_data {
void (*enable)(void __iomem *, u32, unsigned);
void (*fixup)(void __iomem *, u32, struct outer_cache_fns *);
void (*save)(void __iomem *);
+   void (*configure)(void __iomem *);
struct outer_cache_fns outer_cache;
 };
 
 #define CACHE_LINE_SIZE32
 
 static void __iomem *l2x0_base;
+static const struct l2c_init_data *l2x0_data;
 static DEFINE_RAW_SPINLOCK(l2x0_lock);
 static u32 l2x0_way_mask;  /* Bitmask of active ways */
 static u32 l2x0_size;
@@ -106,6 +108,14 @@ static inline void l2c_unlock(void __iomem *base, unsigned 
num)
}
 }
 
+static void l2c_configure(void __iomem *base)
+{
+   if (l2x0_data->configure)
+   l2x0_data->configure(base);
+
+   l2c_write_sec(l2x0_saved_regs.aux_ctrl, base, L2X0_AUX_CTRL);
+}
+
 /*
  * Enable the L2 cache controller.  This function must only be
  * called when the cache controller is known to be disabled.
@@ -114,7 +124,12 @@ static void l2c_enable(void __iomem *base, u32 aux, 
unsigned num_lock)
 {
unsigned long flags;
 
-   l2c_write_sec(aux, base, L2X0_AUX_CTRL);
+   /* Do not touch the controller if already enabled. */
+   if (readl_relaxed(base + L2X0_CTRL) & L2X0_CTRL_EN)
+   return;
+
+   l2x0_saved_regs.aux_ctrl = aux;
+   l2c_configure(base);
 
l2c_unlock(base, num_lock);
 
@@ -208,6 +223,11 @@ static void l2c_save(void __iomem *base)
l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
 }
 
+static void l2c_resume(void)
+{
+   l2c_enable(l2x0_base, l2x0_saved_regs.aux_ctrl, l2x0_data->num_lock);
+}
+
 /*
  * L2C-210 specific code.
  *
@@ -288,14 +308,6 @@ static void l2c210_sync(void)
__l2c210_cache_sync(l2x0_base);
 }
 
-static void l2c210_resume(void)
-{
-   void __iomem *base = l2x0_base;
-
-   if (!(readl_relaxed(base + L2X0_CTRL) & L2X0_CTRL_EN))
-   l2c_enable(base, l2x0_saved_regs.aux_ctrl, 1);
-}
-
 static const struct l2c_init_data l2c210_data __initconst = {
.type = "L2C-210",
.way_size_0 = SZ_8K,
@@ -309,7 +321,7 @@ static const struct l2c_init_data l2c210_data __initconst = 
{
.flush_all = l2c210_flush_all,
.disable = l2c_disable,
.sync = l2c210_sync,
-   .resume = l2c210_resume,
+   .resume = l2c_resume,
},
 };
 
@@ -466,7 +478,7 @@ static const struct l2c_init_data l2c220_data = {
.flush_all = l2c220_flush_all,
.disable = l2c_disable,
.sync = l2c220_sync,
-   .resume = l2c210_resume,
+   .resume = l2c_resume,
},
 };
 
@@ -615,39 +627,29 @@ static void __init l2c310_save(void __iomem *base)
L310_POWER_CTRL);
 }
 
-static void l2c310_resume(void)
+static void l2c310_configure(void __iomem *base)
 {
-   void __iomem *base = l2x0_base;
+   unsigned revision;
 
-   if (!(readl_relaxed(base + L2X0_CTRL) & L2X0_CTRL_EN)) {
-   unsigned revision;
-
-   /* restore pl310 setup */
-   writel_relaxed(l2x0_saved_regs.tag_latency,
-  base + L310_TAG_LATENCY_CTRL);
-   writel_relaxed(l2x0_saved_regs.data_latency,
-  base + L310_DATA_LATENCY_CTRL);
-   writel_relaxed(l2x0_saved_regs.filter_end,
-  base + L310_ADDR_FILTER_END);
-   writel_relaxed(l2x0_saved_regs.filter_start,
-  base + L310_ADDR_FILTER_START);
-
-   revision = readl_relaxed(base + L2X0_CACHE_ID) &
-   L2X0_CACHE_ID_RTL_MASK;
-
-   if (revision >= L310_CACHE_ID_RTL_R2P0)
-   l2c_write_sec(l2x0_saved_regs.prefetch_ctrl, base,
- L310_PREFETCH_CTRL);
-   if (revision >= L310_CACH

[PATCH v8 7/7] ARM: dts: exynos4: Add nodes for L2 cache controller

2014-11-13 Thread Marek Szyprowski
From: Tomasz Figa 

This patch adds device tree nodes for L2 cache controller present on
Exynos4 SoCs.

Signed-off-by: Tomasz Figa 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/boot/dts/exynos4210.dtsi |  9 +
 arch/arm/boot/dts/exynos4x12.dtsi | 14 ++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210.dtsi 
b/arch/arm/boot/dts/exynos4210.dtsi
index bcc9e63c8070..8e45ea44317e 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -81,6 +81,15 @@
reg = <0x10023CA0 0x20>;
};
 
+   l2c: l2-cache-controller@10502000 {
+   compatible = "arm,pl310-cache";
+   reg = <0x10502000 0x1000>;
+   cache-unified;
+   cache-level = <2>;
+   arm,tag-latency = <2 2 1>;
+   arm,data-latency = <2 2 1>;
+   };
+
gic: interrupt-controller@1049 {
cpu-offset = <0x8000>;
};
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi 
b/arch/arm/boot/dts/exynos4x12.dtsi
index 861bb919f6d3..c7adfd60ad3a 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -54,6 +54,20 @@
reg = <0x10023CA0 0x20>;
};
 
+   l2c: l2-cache-controller@10502000 {
+   compatible = "arm,pl310-cache";
+   reg = <0x10502000 0x1000>;
+   cache-unified;
+   cache-level = <2>;
+   arm,tag-latency = <2 2 1>;
+   arm,data-latency = <3 2 1>;
+   arm,double-linefill = <1>;
+   arm,double-linefill-incr = <0>;
+   arm,double-linefill-wrap = <1>;
+   arm,prefetch-drop = <1>;
+   arm,prefetch-offset = <7>;
+   };
+
clock: clock-controller@1003 {
compatible = "samsung,exynos4412-clock";
reg = <0x1003 0x2>;
-- 
1.9.2

--
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 v8 6/7] ARM: EXYNOS: Add support for non-secure L2X0 resume

2014-11-13 Thread Marek Szyprowski
From: Tomasz Figa 

On Exynos SoCs it is necessary to resume operation of L2C early in
assembly code, because otherwise certain systems will crash. This patch
adds necessary code to non-secure resume handler.

Signed-off-by: Tomasz Figa 
[rewrote the code accessing l2x0_saved_regs]
Sigend-off-by: Marek Szyprowski 
---
 arch/arm/mach-exynos/sleep.S | 46 
 1 file changed, 46 insertions(+)

diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S
index e3c373082bbe..31d25834b9c4 100644
--- a/arch/arm/mach-exynos/sleep.S
+++ b/arch/arm/mach-exynos/sleep.S
@@ -16,6 +16,8 @@
  */
 
 #include 
+#include 
+#include 
 #include "smc.h"
 
 #define CPU_MASK   0xff00
@@ -74,6 +76,45 @@ ENTRY(exynos_cpu_resume_ns)
mov r0, #SMC_CMD_C15RESUME
dsb
smc #0
+#ifdef CONFIG_CACHE_L2X0
+   adr r0, 1f
+   ldr r2, [r0]
+   add r0, r2, r0
+
+   /* Check that the address has been initialised. */
+   ldr r1, [r0, #L2X0_R_PHY_BASE]
+   teq r1, #0
+   beq skip_l2x0
+
+   /* Check if controller has been enabled. */
+   ldr r2, [r1, #L2X0_CTRL]
+   tst r2, #0x1
+   bne skip_l2x0
+
+   ldr r1, [r0, #L2X0_R_TAG_LATENCY]
+   ldr r2, [r0, #L2X0_R_DATA_LATENCY]
+   ldr r3, [r0, #L2X0_R_PREFETCH_CTRL]
+   mov r0, #SMC_CMD_L2X0SETUP1
+   smc #0
+
+   /* Reload saved regs pointer because smc corrupts registers. */
+   adr r0, 1f
+   ldr r2, [r0]
+   add r0, r2, r0
+
+   ldr r1, [r0, #L2X0_R_PWR_CTRL]
+   ldr r2, [r0, #L2X0_R_AUX_CTRL]
+   mov r0, #SMC_CMD_L2X0SETUP2
+   smc #0
+
+   mov r0, #SMC_CMD_L2X0INVALL
+   smc #0
+
+   mov r1, #1
+   mov r0, #SMC_CMD_L2X0CTRL
+   smc #0
+skip_l2x0:
+#endif /* CONFIG_CACHE_L2X0 */
 skip_cp15:
b   cpu_resume
 ENDPROC(exynos_cpu_resume_ns)
@@ -83,3 +124,8 @@ cp15_save_diag:
.globl cp15_save_power
 cp15_save_power:
.long   0   @ cp15 power control
+
+#ifdef CONFIG_CACHE_L2X0
+   .align
+1: .long   l2x0_saved_regs - .
+#endif /* CONFIG_CACHE_L2X0 */
-- 
1.9.2

--
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 v8 2/7] ARM: l2c: Add interface to ask hypervisor to configure L2C

2014-11-13 Thread Marek Szyprowski
From: Tomasz Figa 

Because certain secure hypervisor do not allow writes to individual L2C
registers, but rather expect set of parameters to be passed as argument
to secure monitor calls, there is a need to provide an interface for the
L2C driver to ask the firmware to configure the hardware according to
specified parameters. This patch adds such.

Signed-off-by: Tomasz Figa 
Signed-off-by: Marek Szyprowski 
---
 arch/arm/include/asm/outercache.h | 3 +++
 arch/arm/mm/cache-l2x0.c  | 6 ++
 2 files changed, 9 insertions(+)

diff --git a/arch/arm/include/asm/outercache.h 
b/arch/arm/include/asm/outercache.h
index 891a56b35bcf..563b92fc2f41 100644
--- a/arch/arm/include/asm/outercache.h
+++ b/arch/arm/include/asm/outercache.h
@@ -23,6 +23,8 @@
 
 #include 
 
+struct l2x0_regs;
+
 struct outer_cache_fns {
void (*inv_range)(unsigned long, unsigned long);
void (*clean_range)(unsigned long, unsigned long);
@@ -36,6 +38,7 @@ struct outer_cache_fns {
 
/* This is an ARM L2C thing */
void (*write_sec)(unsigned long, unsigned);
+   void (*configure)(const struct l2x0_regs *);
 };
 
 extern struct outer_cache_fns outer_cache;
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index e5948c5adaa7..d214be207517 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -110,6 +110,11 @@ static inline void l2c_unlock(void __iomem *base, unsigned 
num)
 
 static void l2c_configure(void __iomem *base)
 {
+   if (outer_cache.configure) {
+   outer_cache.configure(&l2x0_saved_regs);
+   return;
+   }
+
if (l2x0_data->configure)
l2x0_data->configure(base);
 
@@ -910,6 +915,7 @@ static int __init __l2c_init(const struct l2c_init_data 
*data,
 
fns = data->outer_cache;
fns.write_sec = outer_cache.write_sec;
+   fns.configure = outer_cache.configure;
if (data->fixup)
data->fixup(l2x0_base, cache_id, &fns);
 
-- 
1.9.2

--
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 4/4 V3] ASoC: rt5631: Adding Device Tree compatibility to Realtek's ALC5631/RT5631 codec driver

2014-11-13 Thread Krishna Mohan Dani
Signed-off-by: Krishna Mohan Dani 
---
 sound/soc/codecs/rt5631.c |9 +
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c
index 1ba27db..3b7d5e4 100644
--- a/sound/soc/codecs/rt5631.c
+++ b/sound/soc/codecs/rt5631.c
@@ -1686,10 +1686,18 @@ static struct snd_soc_codec_driver soc_codec_dev_rt5631 
= {
 
 static const struct i2c_device_id rt5631_i2c_id[] = {
{ "rt5631", 0 },
+   { "alc5631", 0 },
{ }
 };
 MODULE_DEVICE_TABLE(i2c, rt5631_i2c_id);
 
+static struct of_device_id rt5631_i2c_dt_ids[] = {
+   { .compatible = "realtek,rt5631"},
+   { .compatible = "realtek,alc5631"},
+   { }
+};
+MODULE_DEVICE_TABLE(of, rt5631_i2c_dt_ids);
+
 static const struct regmap_config rt5631_regmap_config = {
.reg_bits = 8,
.val_bits = 16,
@@ -1734,6 +1742,7 @@ static struct i2c_driver rt5631_i2c_driver = {
.driver = {
.name = "rt5631",
.owner = THIS_MODULE,
+   .of_match_table = of_match_ptr(rt5631_i2c_dt_ids),
},
.probe = rt5631_i2c_probe,
.remove   = rt5631_i2c_remove,
-- 
1.7.9.5

--
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/4 V3] Sound: Kconfig: Adding the description of the codec

2014-11-13 Thread Krishna Mohan Dani
Signed-off-by: Krishna Mohan Dani 
---
 sound/soc/codecs/Kconfig |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index a68d173..7e43e97 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -487,7 +487,8 @@ config SND_SOC_RT286
depends on I2C
 
 config SND_SOC_RT5631
-   tristate
+   tristate "Realtek ALC5631/RT5631 CODEC"
+   depends on I2C
 
 config SND_SOC_RT5640
tristate
-- 
1.7.9.5

--
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 2/4 V3] ASoC: Samsung: Add arndale_rt5631 machine driver

2014-11-13 Thread Krishna Mohan Dani
Adding machine driver to instantiate I2S based realtek's ALC5631
sound card on Arndale board.

There are other variants of Audio Daughter Cards for Arndale
Board for which support already exists but there is no support for
Realtek's alc5631 codec hence support for ALC5631 based machine
driver is being added.

Signed-off-by: Claude Youn 
Signed-off-by: Krishna Mohan Dani 
---
 sound/soc/samsung/Kconfig  |6 ++
 sound/soc/samsung/Makefile |2 +
 sound/soc/samsung/arndale_rt5631.c |  150 
 3 files changed, 158 insertions(+)
 create mode 100644 sound/soc/samsung/arndale_rt5631.c

diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 55a3869..80b5c61 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -239,3 +239,9 @@ config SND_SOC_ODROIDX2
select SND_SAMSUNG_I2S
help
  Say Y here to enable audio support for the Odroid-X2/U3.
+
+config SND_SOC_ARNDALE_RT5631_ALC5631
+tristate "Audio support for RT5631(ALC5631) on Arndale Board"
+depends on SND_SOC_SAMSUNG
+select SND_SAMSUNG_I2S
+select SND_SOC_RT5631
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index 91505dd..31e3dba 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -45,6 +45,7 @@ snd-soc-lowland-objs := lowland.o
 snd-soc-littlemill-objs := littlemill.o
 snd-soc-bells-objs := bells.o
 snd-soc-odroidx2-max98090-objs := odroidx2_max98090.o
+snd-soc-arndale-rt5631-objs := arndale_rt5631.o
 
 obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o
 obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
@@ -71,3 +72,4 @@ obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o
 obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o
 obj-$(CONFIG_SND_SOC_BELLS) += snd-soc-bells.o
 obj-$(CONFIG_SND_SOC_ODROIDX2) += snd-soc-odroidx2-max98090.o
+obj-$(CONFIG_SND_SOC_ARNDALE_RT5631_ALC5631) += snd-soc-arndale-rt5631.o
diff --git a/sound/soc/samsung/arndale_rt5631.c 
b/sound/soc/samsung/arndale_rt5631.c
new file mode 100644
index 000..3495ad5
--- /dev/null
+++ b/sound/soc/samsung/arndale_rt5631.c
@@ -0,0 +1,150 @@
+/*
+ *  arndale_rt5631.c
+ *
+ *  Copyright (c) 2014, Insignal Co., Ltd.
+ *
+ *  Author: Claude 
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "i2s.h"
+
+static int arndale_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream->private_data;
+   struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+   struct snd_soc_dai *codec_dai = rtd->codec_dai;
+   int rfs, ret;
+   unsigned long rclk;
+
+   rfs = 256;
+
+   rclk = params_rate(params) * rfs;
+
+   ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK,
+   0, SND_SOC_CLOCK_OUT);
+   if (ret < 0)
+   return ret;
+
+   ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_RCLKSRC_0,
+   0, SND_SOC_CLOCK_OUT);
+
+   if (ret < 0)
+   return ret;
+
+   ret = snd_soc_dai_set_sysclk(codec_dai, 0, rclk, SND_SOC_CLOCK_OUT);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+
+static struct snd_soc_ops arndale_ops = {
+   .hw_params = arndale_hw_params,
+};
+
+static struct snd_soc_dai_link arndale_rt5631_dai[] = {
+   {
+   .name = "RT5631 HiFi",
+   .stream_name = "Primary",
+   .codec_dai_name = "rt5631-hifi",
+   .dai_fmt = SND_SOC_DAIFMT_I2S
+   | SND_SOC_DAIFMT_NB_NF
+   | SND_SOC_DAIFMT_CBS_CFS,
+   .ops = &arndale_ops,
+   },
+};
+
+static struct snd_soc_card arndale_rt5631 = {
+   .name = "Arndale RT5631",
+   .dai_link = arndale_rt5631_dai,
+   .num_links = ARRAY_SIZE(arndale_rt5631_dai),
+};
+
+static int arndale_audio_probe(struct platform_device *pdev)
+{
+   int n, ret;
+   struct device_node *np = pdev->dev.of_node;
+   struct snd_soc_card *card = &arndale_rt5631;
+
+   card->dev = &pdev->dev;
+
+   for (n = 0; np && n < ARRAY_SIZE(arndale_rt5631_dai); n++) {
+   if (!arndale_rt5631_dai[n].cpu_dai_name) {
+   arndale_rt5631_dai[n].cpu_of_node = of_parse_phandle(np,
+   "samsung,audio-cpu", n);
+
+   if (!arndale_rt5631_dai[n].cpu_of_node) {
+   dev_err(&pdev->dev,
+   "Property 'samsung,audio-cpu' missing or 
invalid\n");
+

[PATCH 1/4 V3] ASoC: ALC5631/RT5631: Add device tree binding documentation

2014-11-13 Thread Krishna Mohan Dani
Document the device tree binding for the ALC5631 codec and update vendor
specific prefix for the Realtek.

Signed-off-by: Krishna Mohan Dani 
---
 Documentation/devicetree/bindings/sound/rt5631.txt |   48 
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/rt5631.txt

diff --git a/Documentation/devicetree/bindings/sound/rt5631.txt 
b/Documentation/devicetree/bindings/sound/rt5631.txt
new file mode 100644
index 000..92b986c
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/rt5631.txt
@@ -0,0 +1,48 @@
+ALC5631/RT5631 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+  - compatible : "realtek,alc5631" or "realtek,rt5631"
+
+  - reg : the I2C address of the device.
+
+Pins on the device (for linking into audio routes):
+
+  * SPK_OUT_R_P
+  * SPK_OUT_R_N
+  * SPK_OUT_L_P
+  * SPK_OUT_L_N
+  * HP_OUT_L
+  * HP_OUT_R
+  * AUX_OUT2_LP
+  * AUX_OUT2_RN
+  * AUX_OUT1_LP
+  * AUX_OUT1_RN
+  * AUX_IN_L_JD
+  * AUX_IN_R_JD
+  * MONO_IN_P
+  * MONO_IN_N
+  * MIC1_P
+  * MIC1_N
+  * MIC2_P
+  * MIC2_N
+  * MONO_OUT_P
+  * MONO_OUT_N
+  * MICBIAS1
+  * MICBIAS2
+
+Example:
+
+alc5631: alc5631@1a {
+   compatible = "realtek,alc5631";
+   reg = <0x1a>;
+};
+
+or
+
+rt5631: rt5631@1a {
+   compatible = "realtek,rt5631";
+   reg = <0x1a>;
+};
-- 
1.7.9.5

--
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 0/4 V3] Arndale: Adding Sound Machine Driver for ALC5631 Codec

2014-11-13 Thread Krishna Mohan Dani
These patches add machine driver to instantiate I2S based realtek's
 ALC5631 based sound card on Arndale board.

There are other variants of Audio Daughter Cards for Arndale
Board for which support already exists but there is no support for
Realtek's alc5631 codec based card hence support for ALC5631 based
machine driver is being added.

Most of the code has been pulled from insignal's git for Arndale and
modified to suit the maintain syntax. Machine driver has been made
DT compatible.

Changes done:
- Removed ifdef for of_device_id structure as commented by Mark Brown
- Supporting both variants of device name:alc5631 and rt5631 as
  commented by Mark Brown
- Added "return -EINVAL" if cpu_of_node or codec_of_node is not
  found in dtb, as commented by Anil Kumar
- Removed i2s specific changes
- Added signed off of claude
- Removed CONFIG_OF check from rt5631.c codec driver and other changes

Krishna Mohan Dani (4):
  ASoC: ALC5631/RT5631: Add device tree binding documentation
  ASoC: Samsung: Add arndale_rt5631 machine driver
  Sound: Kconfig: Adding the description of the codec
  ASoC: rt5631: Adding Device Tree compatibility to Realtek's
ALC5631/RT5631 codec driver

 Documentation/devicetree/bindings/sound/rt5631.txt |   48 +++
 sound/soc/codecs/Kconfig   |3 +-
 sound/soc/codecs/rt5631.c  |9 ++
 sound/soc/samsung/Kconfig  |6 +
 sound/soc/samsung/Makefile |2 +
 sound/soc/samsung/arndale_rt5631.c |  150 
 6 files changed, 217 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/sound/rt5631.txt
 create mode 100644 sound/soc/samsung/arndale_rt5631.c

-- 
1.7.9.5

--
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 2/4 V2] ASoC: Samsung: Add arndale_rt5631 machine driver

2014-11-13 Thread Mark Brown
On Thu, Nov 13, 2014 at 03:45:57PM +0530, D Krishna Mohan wrote:

> From the rest of the comment what I understand is you want me to change the
> names of struct snd_soc_dai_link and struct snd_soc_card.
> Am that right? and/or do you want me to change the names whereever it sounds
> like generic and make it specific for arndale - rt5631 pair?

The latter, but just the former might be OK.


signature.asc
Description: Digital signature


Re: [PATCH 2/4 V2] ASoC: Samsung: Add arndale_rt5631 machine driver

2014-11-13 Thread D Krishna Mohan



--
From: "Mark Brown" 
Sent: Thursday, November 13, 2014 3:59 AM
To: "Krishna Mohan Dani" 
Cc: ; 
; ; 


Subject: Re: [PATCH 2/4 V2] ASoC: Samsung: Add arndale_rt5631 machine driver



+static struct snd_soc_card arndale = {
+   .name = "Arndale-I2S",
+   .dai_link = arndale_dai,
+   .num_links = ARRAY_SIZE(arndale_dai),
+};



Please give the card a more specific name like "Arndale RT5631" and
similarly update the symbol names, there are other modules for the
Arndale board.


Ok I changed the name from "Arndale-I2S" to "Arndale-RT5631".
From the rest of the comment what I understand is you want me to change the 

names of struct snd_soc_dai_link and struct snd_soc_card.
Am that right? and/or do you want me to change the names whereever it sounds 
like generic and make it specific for arndale - rt5631 pair?



--
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 0/6] exynos: Move pmu driver to driver/soc folder and add exynos7 support

2014-11-13 Thread amit daniel kachhap
On Sat, Nov 8, 2014 at 6:46 PM, Amit Daniel Kachhap
 wrote:
> This patch series[1 - 6] performs,
>
> 1) Moves pmu driver to driver/soc/samsung folder. Some discussion happened 
> about
>this in the v1 version. Finally adding it in driver/soc folder as it too 
> SoC
>specific and not a general driver. Entire discussion can be found here (A).
> 2) Registers this driver as MFD client driver. This will be used by clients 
> like exynos pm
>sleep and pm domain driver.
> 3) Add exynos7 PMU support.
>
> Changes from V1:
> * Move pmu driver in driver/soc/samsung folder
> * Removed the power domain features. They will posted as a separate series.
> * Added exynos7 PMU support.
> * Link to v1 can be found here (B)
>
> This patch has dependency on following patches posted earlier by Pankaj (C),
> which is accepted by maintainer.
>
> Patch 6 was earlier posted by Abhilash (D) which has been reposted here with 
> some
> extra changes.
>
> This complete patch series is rebased on linux-next.
>
> (A) - http://www.spinics.net/lists/linux-samsung-soc/msg38444.html
> (B) - http://www.spinics.net/lists/linux-samsung-soc/msg38442.html
> (C) - https://lkml.org/lkml/2014/10/6/581
> (D) - http://www.spinics.net/lists/arm-kernel/msg358230.html
>
> Amit Daniel Kachhap (6):
>   ARM: EXYNOS: Move pmu specific header files under "linux/soc/samsung"
>   drivers: soc: Add support for Exynos PMU driver
>   drivers: soc: samsung: Fix a spelling mistake
>   soc: samsung: exynos-pmu: Register exynos-pmu driver as a mfd driver
>   driver: soc: exynos-pmu: Add an API to be called after wakeup
>   drivers: soc: samsung: Add support for Exynos7 pmu
>
>  .../devicetree/bindings/arm/samsung/pmu.txt|1 +
>  arch/arm/mach-exynos/Makefile  |2 +-
>  arch/arm/mach-exynos/exynos.c  |2 +-
>  arch/arm/mach-exynos/mcpm-exynos.c |2 +-
>  arch/arm/mach-exynos/platsmp.c |2 +-
>  arch/arm/mach-exynos/pm.c  |4 +-
>  arch/arm/mach-exynos/regs-pmu.h|  335 ---
>  arch/arm/mach-exynos/suspend.c |3 +-
>  drivers/soc/Kconfig|1 +
>  drivers/soc/Makefile   |1 +
>  drivers/soc/samsung/Kconfig|   19 +
>  drivers/soc/samsung/Makefile   |1 +
>  .../pmu.c => drivers/soc/samsung/exynos-pmu.c  |  471 ++-

Hi Olof/Kukjin,

I am not sure that driver/soc/samsung/* shall go in whose tree.
I am preparing the next version so if any comment from your side
please let me know.

Regards,
Amit

>  .../linux/soc/samsung}/exynos-pmu.h|6 +
>  include/linux/soc/samsung/exynos-regs-pmu.h|  608 
> 
>  15 files changed, 1109 insertions(+), 349 deletions(-)
>  delete mode 100644 arch/arm/mach-exynos/regs-pmu.h
>  create mode 100644 drivers/soc/samsung/Kconfig
>  create mode 100644 drivers/soc/samsung/Makefile
>  rename arch/arm/mach-exynos/pmu.c => drivers/soc/samsung/exynos-pmu.c (50%)
>  rename {arch/arm/mach-exynos => include/linux/soc/samsung}/exynos-pmu.h (78%)
>  create mode 100644 include/linux/soc/samsung/exynos-regs-pmu.h
>
> --
> 1.7.9.5
>
> --
> 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
--
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 v3 RESEND 1/2] drm/exynos: dp: Remove support for unused dptx-phy

2014-11-13 Thread Inki Dae
On 2014년 11월 12일 18:42, Vivek Gautam wrote:
> Now that we have moved to generic phy based bindings,
> we don't need to have any code related to older dptx-phy.
> Nobody is using this dptx-phy anymore, so removing the
> same.

Applied.

Thanks,
Inki Dae

> 
> Signed-off-by: Vivek Gautam 
> Acked-by: Jingoo Han 
> Cc: Inki Dae 
> ---
> 
> Problem with my mail client caused change in author's mail id.
> So resending it with authorship under my Samsung id.
> 
>  drivers/gpu/drm/exynos/exynos_dp_core.c |   74 
> +++
>  drivers/gpu/drm/exynos/exynos_dp_core.h |2 -
>  2 files changed, 17 insertions(+), 59 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
> b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index cd50ece..dbe9add 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -1052,28 +1052,14 @@ static int exynos_dp_create_connector(struct 
> exynos_drm_display *display,
>  
>  static void exynos_dp_phy_init(struct exynos_dp_device *dp)
>  {
> - if (dp->phy) {
> + if (dp->phy)
>   phy_power_on(dp->phy);
> - } else if (dp->phy_addr) {
> - u32 reg;
> -
> - reg = __raw_readl(dp->phy_addr);
> - reg |= dp->enable_mask;
> - __raw_writel(reg, dp->phy_addr);
> - }
>  }
>  
>  static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
>  {
> - if (dp->phy) {
> + if (dp->phy)
>   phy_power_off(dp->phy);
> - } else if (dp->phy_addr) {
> - u32 reg;
> -
> - reg = __raw_readl(dp->phy_addr);
> - reg &= ~(dp->enable_mask);
> - __raw_writel(reg, dp->phy_addr);
> - }
>  }
>  
>  static void exynos_dp_poweron(struct exynos_drm_display *display)
> @@ -1210,44 +1196,6 @@ static struct video_info 
> *exynos_dp_dt_parse_pdata(struct device *dev)
>   return dp_video_config;
>  }
>  
> -static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp)
> -{
> - struct device_node *dp_phy_node = of_node_get(dp->dev->of_node);
> - u32 phy_base;
> - int ret = 0;
> -
> - dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy");
> - if (!dp_phy_node) {
> - dp->phy = devm_phy_get(dp->dev, "dp");
> - return PTR_ERR_OR_ZERO(dp->phy);
> - }
> -
> - if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) {
> - dev_err(dp->dev, "failed to get reg for dptx-phy\n");
> - ret = -EINVAL;
> - goto err;
> - }
> -
> - if (of_property_read_u32(dp_phy_node, "samsung,enable-mask",
> - &dp->enable_mask)) {
> - dev_err(dp->dev, "failed to get enable-mask for dptx-phy\n");
> - ret = -EINVAL;
> - goto err;
> - }
> -
> - dp->phy_addr = ioremap(phy_base, SZ_4);
> - if (!dp->phy_addr) {
> - dev_err(dp->dev, "failed to ioremap dp-phy\n");
> - ret = -ENOMEM;
> - goto err;
> - }
> -
> -err:
> - of_node_put(dp_phy_node);
> -
> - return ret;
> -}
> -
>  static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
>  {
>   int ret;
> @@ -1277,9 +1225,21 @@ static int exynos_dp_bind(struct device *dev, struct 
> device *master, void *data)
>   if (IS_ERR(dp->video_info))
>   return PTR_ERR(dp->video_info);
>  
> - ret = exynos_dp_dt_parse_phydata(dp);
> - if (ret)
> - return ret;
> + dp->phy = devm_phy_get(dp->dev, "dp");
> + if (IS_ERR(dp->phy)) {
> + dev_err(dp->dev, "no DP phy configured\n");
> + ret = PTR_ERR(dp->phy);
> + if (ret) {
> + /*
> +  * phy itself is not enabled, so we can move forward
> +  * assigning NULL to phy pointer.
> +  */
> + if (ret == -ENOSYS || ret == -ENODEV)
> + dp->phy = NULL;
> + else
> + return ret;
> + }
> + }
>  
>   if (!dp->panel) {
>   ret = exynos_dp_dt_parse_panel(dp);
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h 
> b/drivers/gpu/drm/exynos/exynos_dp_core.h
> index a1aee69..6426201 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.h
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
> @@ -153,8 +153,6 @@ struct exynos_dp_device {
>   struct clk  *clock;
>   unsigned intirq;
>   void __iomem*reg_base;
> - void __iomem*phy_addr;
> - unsigned intenable_mask;
>  
>   struct video_info   *video_info;
>   struct link_train   link_train;
> 

--
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 0/4] drm/exynos/dsi: remove global display variable

2014-11-13 Thread Inki Dae
On 2014년 10월 07일 21:01, Andrzej Hajda wrote:
> Hi Inki,
> 
> Many Exynos DRM drivers uses global variables to represent associated devices
> in Exynos DRM internal framework. It is quite confusing, it adds data 
> duplication
> and finally it does not allow to handle more than one device in system.
> It seems better to embed such structures in private context of the device.
> 
> The patchset is based on exynos_drm_next plus my patch [1]:
> 'drm/exynos: remove explicit encoder/connector de-initialization'.
> 
> If the patchset is OK for you I can prepare similar patches for other Exynos 
> DRM components.

Sorry for late. Applied. Can you prepare similar patches for other? If
so, I'd happy.

Thanks,
Inki Dae

> 
> [1]: https://lkml.org/lkml/2014/9/22/148
> 
> Regards
> Andrzej
> 
> 
> Andrzej Hajda (4):
>   drm/exynos/dsi: remove global variable exynos_dsi_display
>   drm/exynos/dsi: simplify device pointer evaluation
>   drm/exynos/dsi: remove redundant encoder field
>   drm/exynos/dsi: stop using display->ctx pointer
> 
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 96 
> -
>  1 file changed, 47 insertions(+), 49 deletions(-)
> 

--
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 1/9] drm/exynos: remove uneeded declaration of struct dma_iommu_mapping

2014-11-13 Thread Inki Dae
On 2014년 10월 31일 23:17, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> It is not even used in this header anymore.

All patches, Applied.

Thanks,
Inki Dae


> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_iommu.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h 
> b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
> index 72376d4..35d2588 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
> @@ -40,7 +40,6 @@ static inline bool is_drm_iommu_supported(struct drm_device 
> *drm_dev)
>  
>  #else
>  
> -struct dma_iommu_mapping;
>  static inline int drm_create_iommu_mapping(struct drm_device *drm_dev)
>  {
>   return 0;
> 

--
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 1/1] ARM: exynos_defconfig: Enable max77802 rtc and clock drivers

2014-11-13 Thread Javier Martinez Canillas
Hello Kukjin,

On Tue, Oct 28, 2014 at 12:06 PM, Kukjin Kim  wrote:
> Javier Martinez Canillas wrote:
>> Commit 6e80e3d87549 ("ARM: exynos_defconfig: Enable MAX77802")
>> enabled support for the max77802 regulators but the PMIC also
>> has a Real-Time-Clock (RTC) and 2-channel 32kHz clock outputs.
>>
>
> I'll apply this, thanks.
>
> - Kukjin
>

You say that you will apply this patch but I can't find it in any of
your branches.

Best regards,
Javier
--
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 2/4] drm/exynos: fimd: support Exynos4415 SoC

2014-11-13 Thread Inki Dae
On 2014년 11월 07일 15:12, YoungJun Cho wrote:
> This patch supports Exynos4415 SoC.

Applied.

Thanks,
Inki Dae

> 
> Signed-off-by: YoungJun Cho 
> Acked-by: Kyungmin Park 
> ---
>  Documentation/devicetree/bindings/video/samsung-fimd.txt |  1 +
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 11 +++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/video/samsung-fimd.txt 
> b/Documentation/devicetree/bindings/video/samsung-fimd.txt
> index 4e6c77c..cf1af63 100644
> --- a/Documentation/devicetree/bindings/video/samsung-fimd.txt
> +++ b/Documentation/devicetree/bindings/video/samsung-fimd.txt
> @@ -11,6 +11,7 @@ Required properties:
>   "samsung,s5pv210-fimd"; /* for S5PV210 SoC */
>   "samsung,exynos3250-fimd"; /* for Exynos3250/3472 SoCs */
>   "samsung,exynos4210-fimd"; /* for Exynos4 SoCs */
> + "samsung,exynos4415-fimd"; /* for Exynos4415 SoC */
>   "samsung,exynos5250-fimd"; /* for Exynos5 SoCs */
>  
>  - reg: physical base address and length of the FIMD registers set.
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 085b066..5dfbbdb 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -120,6 +120,15 @@ static struct fimd_driver_data exynos4_fimd_driver_data 
> = {
>   .has_shadowcon = 1,
>  };
>  
> +static struct fimd_driver_data exynos4415_fimd_driver_data = {
> + .timing_base = 0x2,
> + .lcdblk_offset = 0x210,
> + .lcdblk_vt_shift = 10,
> + .lcdblk_bypass_shift = 1,
> + .has_shadowcon = 1,
> + .has_vidoutcon = 1,
> +};
> +
>  static struct fimd_driver_data exynos5_fimd_driver_data = {
>   .timing_base = 0x2,
>   .lcdblk_offset = 0x214,
> @@ -180,6 +189,8 @@ static const struct of_device_id fimd_driver_dt_match[] = 
> {
> .data = &exynos3_fimd_driver_data },
>   { .compatible = "samsung,exynos4210-fimd",
> .data = &exynos4_fimd_driver_data },
> + { .compatible = "samsung,exynos4415-fimd",
> +   .data = &exynos4415_fimd_driver_data },
>   { .compatible = "samsung,exynos5250-fimd",
> .data = &exynos5_fimd_driver_data },
>   {},
> 

--
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 1/4] drm/exynos: dsi: support Exynos4415 SoC

2014-11-13 Thread Inki Dae
On 2014년 11월 07일 15:12, YoungJun Cho wrote:
> This patch supports Exynos4415 SoC.
> 

Applied.

Thanks,
Inki Dae

> Signed-off-by: YoungJun Cho 
> Acked-by: Kyungmin Park 
> ---
>  Documentation/devicetree/bindings/video/exynos_dsim.txt | 1 +
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 7 +++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/video/exynos_dsim.txt 
> b/Documentation/devicetree/bindings/video/exynos_dsim.txt
> index e74243b..ca2b4aa 100644
> --- a/Documentation/devicetree/bindings/video/exynos_dsim.txt
> +++ b/Documentation/devicetree/bindings/video/exynos_dsim.txt
> @@ -4,6 +4,7 @@ Required properties:
>- compatible: value should be one of the following
>   "samsung,exynos3250-mipi-dsi" /* for Exynos3250/3472 SoCs */
>   "samsung,exynos4210-mipi-dsi" /* for Exynos4 SoCs */
> + "samsung,exynos4415-mipi-dsi" /* for Exynos4415 SoC */
>   "samsung,exynos5410-mipi-dsi" /* for Exynos5410/5420/5440 SoCs 
> */
>- reg: physical base address and length of the registers set for the device
>- interrupts: should contain DSI interrupt
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
> b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index acf7e9e..ff17c6e 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -316,6 +316,11 @@ static struct exynos_dsi_driver_data 
> exynos4_dsi_driver_data = {
>   .has_clklane_stop = 1,
>  };
>  
> +static struct exynos_dsi_driver_data exynos4415_dsi_driver_data = {
> + .plltmr_reg = 0x58,
> + .has_clklane_stop = 1,
> +};
> +
>  static struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
>   .plltmr_reg = 0x58,
>  };
> @@ -325,6 +330,8 @@ static struct of_device_id exynos_dsi_of_match[] = {
> .data = &exynos3_dsi_driver_data },
>   { .compatible = "samsung,exynos4210-mipi-dsi",
> .data = &exynos4_dsi_driver_data },
> + { .compatible = "samsung,exynos4415-mipi-dsi",
> +   .data = &exynos4415_dsi_driver_data },
>   { .compatible = "samsung,exynos5410-mipi-dsi",
> .data = &exynos5_dsi_driver_data },
>   { }
> 

--
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 v3 2/2] ARM: EXYNOS: Call regulator core suspend prepare and finish functions

2014-11-13 Thread Javier Martinez Canillas
Hello Kukjin,

On 11/13/2014 03:12 AM, Kukjin Kim wrote:
>>
> Oh, sorry. I'm here and applying this patch into samsung tree.
> 

Great, thanks a lot!

Best regards,
Javier

--
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