lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJuYYwQiEHgmn8iJfuENDTAhVQof8M29WHGYePE3a_x3eAZt2Q@mail.gmail.com>
Date:	Fri, 17 Aug 2012 09:25:24 +0530
From:	Thomas Abraham <thomas.abraham@...aro.org>
To:	Amit Daniel Kachhap <amit.kachhap@...aro.org>
Cc:	linux-pm@...ts.linux-foundation.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Zhang Rui <rui.zhang@...el.com>, Len Brown <lenb@...nel.org>,
	linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-acpi@...r.kernel.org, lm-sensors@...sensors.org,
	SangWook Ju <sw.ju@...sung.com>,
	Durgadoss <durgadoss.r@...el.com>,
	Jean Delvare <khali@...ux-fr.org>,
	jonghwa lee <jonghwa3.lee@...sung.com>,
	Kyungmin Park <kmpark@...radead.org>,
	Kukjin Kim <kgene.kim@...sung.com>
Subject: Re: [PATCH v6 5/6] ARM: exynos: add thermal sensor driver platform
 data support

On 16 August 2012 17:11, Amit Daniel Kachhap <amit.kachhap@...aro.org> wrote:
> Add necessary default platform data support needed for TMU driver.  The
> supplied dt/non-dt values are tested for origen exynos4210 and smdk exynos5250
> platforms and only compile tested for exynos4412.
>
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@...aro.org>
> Acked-by: Guenter Roeck <guenter.roeck@...csson.com>
> Cc: SangWook Ju <sw.ju@...sung.com>
> Cc: Durgadoss <durgadoss.r@...el.com>
> Cc: Len Brown <lenb@...nel.org>
> Cc: Jean Delvare <khali@...ux-fr.org>
> Cc: jonghwa lee <jonghwa3.lee@...sung.com>
> Cc: Kyungmin Park <kmpark@...radead.org>
> Cc: Kukjin Kim <kgene.kim@...sung.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@...sung.com>
> ---
>  drivers/thermal/exynos_thermal.c |  111 +++++++++++++++++++++++++++++++++++++-
>  1 files changed, 110 insertions(+), 1 deletions(-)

Reviewed-by: Thomas Abraham <thomas.abraham@...aro.org>

Few minor comments inline below.

>
> diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
> index e79cdc9..03a99e4 100644
> --- a/drivers/thermal/exynos_thermal.c
> +++ b/drivers/thermal/exynos_thermal.c
> @@ -723,14 +723,121 @@ static irqreturn_t exynos_tmu_irq(int irq, void *id)
>  static struct thermal_sensor_conf exynos_sensor_conf = {
>         .name                   = "exynos-therm",
>         .read_temperature       = (int (*)(void *))exynos_tmu_read,
> +};
> +
> +#if defined(CONFIG_CPU_EXYNOS4210)
> +static struct exynos_tmu_platform_data const exynos4210_default_tmu_data = {
> +       .threshold = 80,
> +       .trigger_levels[0] = 5,
> +       .trigger_levels[1] = 20,
> +       .trigger_levels[2] = 30,
> +       .trigger_level0_en = 1,
> +       .trigger_level1_en = 1,
> +       .trigger_level2_en = 1,
> +       .trigger_level3_en = 0,
> +       .gain = 15,
> +       .reference_voltage = 7,
> +       .cal_type = TYPE_ONE_POINT_TRIMMING,
> +       .freq_tab[0] = {
> +               .freq_clip_max = 800 * 1000,
> +               .temp_level = 85,
> +       },
> +       .freq_tab[1] = {
> +               .freq_clip_max = 200 * 1000,
> +               .temp_level = 100,
> +       },
> +       .freq_tab_count = 2,
> +       .type = SOC_ARCH_EXYNOS4210,
> +};
> +#define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data)
> +#else
> +#define EXYNOS4210_TMU_DRV_DATA (NULL)
> +#endif
> +
> +#if defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)
> +static struct exynos_tmu_platform_data const exynos_default_tmu_data = {
> +       .trigger_levels[0] = 85,
> +       .trigger_levels[1] = 103,
> +       .trigger_levels[2] = 110,
> +       .trigger_level0_en = 1,
> +       .trigger_level1_en = 1,
> +       .trigger_level2_en = 1,
> +       .trigger_level3_en = 0,
> +       .gain = 8,
> +       .reference_voltage = 16,
> +       .noise_cancel_mode = 4,
> +       .cal_type = TYPE_ONE_POINT_TRIMMING,
> +       .efuse_value = 55,
> +       .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,
> +       .type = SOC_ARCH_EXYNOS,
> +};
> +#define EXYNOS_TMU_DRV_DATA (&exynos_default_tmu_data)
> +#else
> +#define EXYNOS_TMU_DRV_DATA (NULL)
> +#endif
> +
> +#ifdef CONFIG_OF
> +static const struct of_device_id exynos_tmu_match[] = {
> +       {
> +               .compatible = "samsung,exynos4210-tmu",
> +               .data = (void *)EXYNOS4210_TMU_DRV_DATA,
> +       },
> +       {

This can be  }, {

> +               .compatible = "samsung,exynos5250-tmu",
> +               .data = (void *)EXYNOS_TMU_DRV_DATA,
> +       },
> +       {},
> +};
> +MODULE_DEVICE_TABLE(of, exynos_tmu_match);
> +#else
> +#define  exynos_tmu_match NULL
> +#endif
> +
> +static struct platform_device_id exynos_tmu_driver_ids[] = {
> +       {
> +               .name           = "exynos4210-tmu",
> +               .driver_data    = (kernel_ulong_t)EXYNOS4210_TMU_DRV_DATA,
> +       },
> +       {
> +               .name           = "exynos5250-tmu",
> +               .driver_data    = (kernel_ulong_t)EXYNOS_TMU_DRV_DATA,
> +       },

Since Exynos5250 platforms are dt based, the above entry could be left out.

> +       { },
> +};
> +MODULE_DEVICE_TABLE(platform, exynos4_tmu_driver_ids);
> +
> +static inline struct  exynos_tmu_platform_data *exynos_get_driver_data(
> +                       struct platform_device *pdev)
> +{
> +#ifdef CONFIG_OF
> +       if (pdev->dev.of_node) {
> +               const struct of_device_id *match;
> +               match = of_match_node(exynos_tmu_match, pdev->dev.of_node);
> +               if (!match)
> +                       return NULL;
> +               return (struct exynos_tmu_platform_data *) match->data;
> +       }
> +#endif
> +       return (struct exynos_tmu_platform_data *)
> +                       platform_get_device_id(pdev)->driver_data;
>  }
> -;
>  static int __devinit exynos_tmu_probe(struct platform_device *pdev)
>  {
>         struct exynos_tmu_data *data;
>         struct exynos_tmu_platform_data *pdata = pdev->dev.platform_data;
>         int ret, i;
>
> +       if (!pdata)
> +               pdata = exynos_get_driver_data(pdev);
> +
>         if (!pdata) {
>                 dev_err(&pdev->dev, "No platform init data supplied.\n");
>                 return -ENODEV;
> @@ -899,9 +1006,11 @@ static struct platform_driver exynos_tmu_driver = {
>                 .name   = "exynos-tmu",
>                 .owner  = THIS_MODULE,
>                 .pm     = EXYNOS_TMU_PM,
> +               .of_match_table = exynos_tmu_match,
>         },
>         .probe = exynos_tmu_probe,
>         .remove = __devexit_p(exynos_tmu_remove),
> +       .id_table = exynos_tmu_driver_ids,
>  };
>
>  module_platform_driver(exynos_tmu_driver);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ