From: "Heiko Stübner" <heiko@sntech.de>
To: Kukjin Kim <kgene.kim@samsung.com>
Cc: "'Ben Dooks'" <ben-linux@fluff.org>,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
"Heiko Stübner" <heiko@sntech.de>
Subject: Re: [PATCH 2/7] s3c-adc: describe features via quirk constants
Date: Sun, 2 Oct 2011 13:18:41 +0200 [thread overview]
Message-ID: <201110021318.42131.heiko@sntech.de> (raw)
In-Reply-To: <001a01cc80d6$40bf7e70$c23e7b50$%kim@samsung.com>
Hi Kgene,
Am Sonntag 02 Oktober 2011, 09:38:18 schrieb Kukjin Kim:
> How about following? I think following is also not bad...
ok, I don't claim to have the right solution, so if keeping the TYPE_xxx enum
is better, I will do a rework of the series according to your solution and
resend it.
Could I meanwhile interest you in the patches for the S3C2416 armclk and hsmmc
(from 28 Sep 2011) :-) ?
Thanks
Heiko
> diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
> index ee8deef..f5c6703 100644
> --- a/arch/arm/plat-samsung/adc.c
> +++ b/arch/arm/plat-samsung/adc.c
> @@ -41,6 +41,8 @@
>
> enum s3c_cpu_type {
> TYPE_ADCV1, /* S3C24XX */
> + TYPE_ADCV11, /* S3C2416 */
> + TYPE_ADCV12, /* S3C2443 */
> TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */
> TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
> };
> @@ -98,13 +100,17 @@ static inline void s3c_adc_select(struct adc_device
> *adc,
>
> client->select_cb(client, 1);
>
> - con &= ~S3C2410_ADCCON_MUXMASK;
> + if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
> + con &= ~S3C2410_ADCCON_MUXMASK;
> con &= ~S3C2410_ADCCON_STDBM;
> con &= ~S3C2410_ADCCON_STARTMASK;
>
> if (!client->is_ts) {
> if (cpu == TYPE_ADCV3)
> writel(client->channel & 0xf, adc->regs +
> S5P_ADCMUX);
> + elif (cpu == TYPE_ADCV12)
> + writel(client->channel & 0xf,
> + adc->regs + S3C2443_ADCMUX);
> else
> con |= S3C2410_ADCCON_SELMUX(client->channel);
> }
> @@ -293,13 +299,13 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
>
> client->nr_samples--;
>
> - if (cpu != TYPE_ADCV1) {
> - /* S3C64XX/S5P ADC resolution is 12-bit */
> - data0 &= 0xfff;
> - data1 &= 0xfff;
> - } else {
> + if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV12) {
> data0 &= 0x3ff;
> data1 &= 0x3ff;
> + } else {
> + /* S3C2416, S3C64XX/S5P ADC resolution is 12-bit */
> + data0 &= 0xfff;
> + data1 &= 0xfff;
> }
>
> if (client->convert_cb)
> @@ -320,7 +326,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
> }
>
> exit:
> - if (cpu != TYPE_ADCV1) {
> + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) {
> /* Clear ADC interrupt */
> writel(0, adc->regs + S3C64XX_ADCCLRINT);
> }
> @@ -332,6 +338,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct adc_device *adc;
> struct resource *regs;
> + enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
> int ret;
> unsigned tmp;
>
> @@ -394,10 +401,13 @@ static int s3c_adc_probe(struct platform_device
> *pdev) clk_enable(adc->clk);
>
> tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
> - if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) {
> - /* Enable 12-bit ADC resolution */
> +
> + /* Enable 12-bit ADC resolution */
> + if (cpu == TYPE_ADCV11)
> + tmp |= S3C2416_ADCCON_RESSEL;
> + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
> tmp |= S3C64XX_ADCCON_RESSEL;
> - }
> +
> writel(tmp, adc->regs + S3C2410_ADCCON);
>
> dev_info(dev, "attached adc driver\n");
> @@ -464,6 +474,7 @@ static int s3c_adc_resume(struct device *dev)
> struct platform_device *pdev = container_of(dev,
> struct platform_device, dev);
> struct adc_device *adc = platform_get_drvdata(pdev);
> + enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
> int ret;
> unsigned long tmp;
>
> @@ -474,9 +485,13 @@ static int s3c_adc_resume(struct device *dev)
> enable_irq(adc->irq);
>
> tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
> +
> /* Enable 12-bit ADC resolution */
> - if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1)
> + if (cpu == TYPE_ADCV11)
> + tmp |= S3C2416_ADCCON_RESSEL;
> + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
> tmp |= S3C64XX_ADCCON_RESSEL;
> +
> writel(tmp, adc->regs + S3C2410_ADCCON);
>
> return 0;
> @@ -492,6 +507,12 @@ static struct platform_device_id s3c_adc_driver_ids[]
> = {
> .name = "s3c24xx-adc",
> .driver_data = TYPE_ADCV1,
> }, {
> + .name = "s3c2416-adc",
> + .driver_data = TYPE_ADCV11
> + }, {
> + .name = "s3c2443-adc",
> + .driver_data = TYPE_ADCV12
> + }, {
> .name = "s3c64xx-adc",
> .driver_data = TYPE_ADCV2,
> }, {
>
> Thanks.
>
> Best regards,
> Kgene.
WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/7] s3c-adc: describe features via quirk constants
Date: Sun, 2 Oct 2011 13:18:41 +0200 [thread overview]
Message-ID: <201110021318.42131.heiko@sntech.de> (raw)
In-Reply-To: <001a01cc80d6$40bf7e70$c23e7b50$%kim@samsung.com>
Hi Kgene,
Am Sonntag 02 Oktober 2011, 09:38:18 schrieb Kukjin Kim:
> How about following? I think following is also not bad...
ok, I don't claim to have the right solution, so if keeping the TYPE_xxx enum
is better, I will do a rework of the series according to your solution and
resend it.
Could I meanwhile interest you in the patches for the S3C2416 armclk and hsmmc
(from 28 Sep 2011) :-) ?
Thanks
Heiko
> diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
> index ee8deef..f5c6703 100644
> --- a/arch/arm/plat-samsung/adc.c
> +++ b/arch/arm/plat-samsung/adc.c
> @@ -41,6 +41,8 @@
>
> enum s3c_cpu_type {
> TYPE_ADCV1, /* S3C24XX */
> + TYPE_ADCV11, /* S3C2416 */
> + TYPE_ADCV12, /* S3C2443 */
> TYPE_ADCV2, /* S3C64XX, S5P64X0, S5PC100 */
> TYPE_ADCV3, /* S5PV210, S5PC110, EXYNOS4210 */
> };
> @@ -98,13 +100,17 @@ static inline void s3c_adc_select(struct adc_device
> *adc,
>
> client->select_cb(client, 1);
>
> - con &= ~S3C2410_ADCCON_MUXMASK;
> + if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV2)
> + con &= ~S3C2410_ADCCON_MUXMASK;
> con &= ~S3C2410_ADCCON_STDBM;
> con &= ~S3C2410_ADCCON_STARTMASK;
>
> if (!client->is_ts) {
> if (cpu == TYPE_ADCV3)
> writel(client->channel & 0xf, adc->regs +
> S5P_ADCMUX);
> + elif (cpu == TYPE_ADCV12)
> + writel(client->channel & 0xf,
> + adc->regs + S3C2443_ADCMUX);
> else
> con |= S3C2410_ADCCON_SELMUX(client->channel);
> }
> @@ -293,13 +299,13 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
>
> client->nr_samples--;
>
> - if (cpu != TYPE_ADCV1) {
> - /* S3C64XX/S5P ADC resolution is 12-bit */
> - data0 &= 0xfff;
> - data1 &= 0xfff;
> - } else {
> + if (cpu == TYPE_ADCV1 || cpu == TYPE_ADCV12) {
> data0 &= 0x3ff;
> data1 &= 0x3ff;
> + } else {
> + /* S3C2416, S3C64XX/S5P ADC resolution is 12-bit */
> + data0 &= 0xfff;
> + data1 &= 0xfff;
> }
>
> if (client->convert_cb)
> @@ -320,7 +326,7 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw)
> }
>
> exit:
> - if (cpu != TYPE_ADCV1) {
> + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3) {
> /* Clear ADC interrupt */
> writel(0, adc->regs + S3C64XX_ADCCLRINT);
> }
> @@ -332,6 +338,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct adc_device *adc;
> struct resource *regs;
> + enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
> int ret;
> unsigned tmp;
>
> @@ -394,10 +401,13 @@ static int s3c_adc_probe(struct platform_device
> *pdev) clk_enable(adc->clk);
>
> tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
> - if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1) {
> - /* Enable 12-bit ADC resolution */
> +
> + /* Enable 12-bit ADC resolution */
> + if (cpu == TYPE_ADCV11)
> + tmp |= S3C2416_ADCCON_RESSEL;
> + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
> tmp |= S3C64XX_ADCCON_RESSEL;
> - }
> +
> writel(tmp, adc->regs + S3C2410_ADCCON);
>
> dev_info(dev, "attached adc driver\n");
> @@ -464,6 +474,7 @@ static int s3c_adc_resume(struct device *dev)
> struct platform_device *pdev = container_of(dev,
> struct platform_device, dev);
> struct adc_device *adc = platform_get_drvdata(pdev);
> + enum s3c_cpu_type cpu = platform_get_device_id(pdev)->driver_data;
> int ret;
> unsigned long tmp;
>
> @@ -474,9 +485,13 @@ static int s3c_adc_resume(struct device *dev)
> enable_irq(adc->irq);
>
> tmp = adc->prescale | S3C2410_ADCCON_PRSCEN;
> +
> /* Enable 12-bit ADC resolution */
> - if (platform_get_device_id(pdev)->driver_data != TYPE_ADCV1)
> + if (cpu == TYPE_ADCV11)
> + tmp |= S3C2416_ADCCON_RESSEL;
> + if (cpu == TYPE_ADCV2 || cpu == TYPE_ADCV3)
> tmp |= S3C64XX_ADCCON_RESSEL;
> +
> writel(tmp, adc->regs + S3C2410_ADCCON);
>
> return 0;
> @@ -492,6 +507,12 @@ static struct platform_device_id s3c_adc_driver_ids[]
> = {
> .name = "s3c24xx-adc",
> .driver_data = TYPE_ADCV1,
> }, {
> + .name = "s3c2416-adc",
> + .driver_data = TYPE_ADCV11
> + }, {
> + .name = "s3c2443-adc",
> + .driver_data = TYPE_ADCV12
> + }, {
> .name = "s3c64xx-adc",
> .driver_data = TYPE_ADCV2,
> }, {
>
> Thanks.
>
> Best regards,
> Kgene.
next prev parent reply other threads:[~2011-10-02 11:18 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-18 20:41 [PATCH v2 0/7] S3C2443/S3C2416: Implement support for ADC Heiko Stübner
2011-09-18 20:41 ` Heiko Stübner
2011-09-18 20:42 ` [PATCH 1/7] S3C2443/S3C2416: Add adc registers Heiko Stübner
2011-09-18 20:42 ` Heiko Stübner
2011-09-28 6:42 ` [PATCH v2 1/2] " Heiko Stübner
2011-09-28 6:42 ` Heiko Stübner
2011-09-18 20:43 ` [PATCH 2/7] s3c-adc: describe features via quirk constants Heiko Stübner
2011-09-18 20:43 ` Heiko Stübner
2011-09-21 12:32 ` Kukjin Kim
2011-09-21 12:32 ` Kukjin Kim
2011-09-21 13:04 ` Heiko Stübner
2011-09-21 13:04 ` Heiko Stübner
2011-10-02 7:38 ` Kukjin Kim
2011-10-02 7:38 ` Kukjin Kim
2011-10-02 11:18 ` Heiko Stübner [this message]
2011-10-02 11:18 ` Heiko Stübner
2011-10-04 12:45 ` Kukjin Kim
2011-10-04 12:45 ` Kukjin Kim
2011-10-10 4:28 ` Kukjin Kim
2011-10-10 4:28 ` Kukjin Kim
2011-10-10 9:42 ` Heiko Stübner
2011-10-10 9:42 ` Heiko Stübner
2011-10-10 10:03 ` Kukjin Kim
2011-10-10 10:03 ` Kukjin Kim
2011-09-28 6:43 ` [PATCH v2 2/2] " Heiko Stübner
2011-09-28 6:43 ` Heiko Stübner
2011-09-18 20:44 ` [PATCH 3/7] s3c-adc: Replace TYPE_ADCVx conditionals with quirks Heiko Stübner
2011-09-18 20:44 ` Heiko Stübner
2011-09-18 20:45 ` [PATCH 4/7] s3c-adc: Fix mux bit modification in s3c_adc_select Heiko Stübner
2011-09-18 20:45 ` Heiko Stübner
2011-09-18 20:47 ` [PATCH 5/7] S3C24XX: Allow overriding of adc device name Heiko Stübner
2011-09-18 20:47 ` Heiko Stübner
2011-09-18 20:47 ` [PATCH v2 6/7] s3c-adc: Add support for S3C2443 Heiko Stübner
2011-09-18 20:47 ` Heiko Stübner
2011-09-18 20:49 ` [PATCH v2 7/7] s3c-adc: Add support for S3C2416/S3C2450 Heiko Stübner
2011-09-18 20:49 ` Heiko Stübner
-- strict thread matches above, loose matches on Subject: below --
2011-09-08 19:51 [PATCH 0/7] S3C2443/S3C2416: Implement support for ADC Heiko Stübner
2011-09-08 19:53 ` [PATCH 2/7] s3c-adc: describe features via quirk constants Heiko Stübner
2011-09-08 19:53 ` Heiko Stübner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201110021318.42131.heiko@sntech.de \
--to=heiko@sntech.de \
--cc=ben-linux@fluff.org \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.