From: Wanlong Gao <wanlong.gao@gmail.com>
To: Haojian Zhuang <hzhuang1@marvell.com>
Cc: "sameo@linux.intel.com" <sameo@linux.intel.com>,
"haojian.zhuang@gmail.com" <haojian.zhuang@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Subject: Re: [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control + DS1WM chip
Date: Thu, 14 Apr 2011 22:29:17 +0800 [thread overview]
Message-ID: <4DA704BD.7090501@gmail.com> (raw)
In-Reply-To: <25B60CDC2F704E4E9D88FFD52780CB4C05CF05AC11@SC-VEXCH1.marvell.com>
于 2011-4-14 22:21, Haojian Zhuang 写道:
>
>
>> -----Original Message-----
>> From: gaowanlong@gmail.com [mailto:gaowanlong@gmail.com] On Behalf Of
>> Wanlong Gao
>> Sent: 2011年4月14日 10:18 PM
>> To: Haojian Zhuang
>> Cc: sameo@linux.intel.com; haojian.zhuang@gmail.com; linux-
>> kernel@vger.kernel.org; Evgeniy Polyakov
>> Subject: Re: [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control
>> + DS1WM chip
>>
>> On 4/13/11, Haojian Zhuang<haojian.zhuang@marvell.com> wrote:
>>> This driver provides registers and IRQ of PXA3xx chips to the ds1wm
>> driver.
>>>
>>> Signed-off-by: Haojian Zhuang<haojian.zhuang@marvell.com>
>>> Cc: Evgeniy Polyakov<johnpol@2ka.mipt.ru>
>>> ---
>>> drivers/mfd/Kconfig | 7 ++
>>> drivers/mfd/Makefile | 1 +
>>> drivers/mfd/pxa-w1.c | 150
>>> ++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 3 files changed, 158 insertions(+), 0 deletions(-)
>>> create mode 100644 drivers/mfd/pxa-w1.c
>>>
>>> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
>>> index e2fea58..b6ecf90 100644
>>> --- a/drivers/mfd/Kconfig
>>> +++ b/drivers/mfd/Kconfig
>>> @@ -34,6 +34,13 @@ config MFD_88PM860X
>>> select individual components like voltage regulators, RTC and
>>> battery-charger under the corresponding menus.
>>>
>>> +config MFD_PXA_DS1WM
>>> + tristate "Support DS1WM chip on Marvell silicons"
>>> + select MFD_CORE
>>> + help
>>> + This core driver provides register access for PXA_DS1WM.
>>> + Actual functionality is handled by the ds1wm drivers.
>>> +
>>> config MFD_SM501
>>> tristate "Support for Silicon Motion SM501"
>>> ---help---
>>> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
>>> index 419caa9..4f8d1d2 100644
>>> --- a/drivers/mfd/Makefile
>>> +++ b/drivers/mfd/Makefile
>>> @@ -4,6 +4,7 @@
>>>
>>> 88pm860x-objs := 88pm860x-core.o 88pm860x-i2c.o
>>> obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o
>>> +obj-$(CONFIG_MFD_PXA_DS1WM) += pxa-w1.o
>>> obj-$(CONFIG_MFD_SM501) += sm501.o
>>> obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
>>>
>>> diff --git a/drivers/mfd/pxa-w1.c b/drivers/mfd/pxa-w1.c
>>> new file mode 100644
>>> index 0000000..98074ff
>>> --- /dev/null
>>> +++ b/drivers/mfd/pxa-w1.c
>>> @@ -0,0 +1,150 @@
>>> +/*
>>> + * Core driver for PXA DS1WM chip.
>>> + *
>>> + * Copyright (C) 2010 Marvell<jtzhou@marvell.com>
>>> + *
>>> + * 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; version 2 of the License.
>>> + */
>>> +
>>> +#include<linux/init.h>
>>> +#include<linux/module.h>
>>> +#include<linux/slab.h>
>>> +#include<linux/platform_device.h>
>>> +#include<linux/gpio.h>
>>> +#include<linux/io.h>
>>> +#include<linux/irq.h>
>>> +#include<linux/clk.h>
>>> +#include<linux/err.h>
>>> +#include<linux/interrupt.h>
>>> +#include<linux/mfd/core.h>
>>> +#include<linux/mfd/ds1wm.h>
>>> +
>>> +struct pxa_w1_info {
>>> + struct clk *clk;
>>> +};
>>> +
>>> +static int ds1wm_enable(struct platform_device *pdev)
>>> +{
>>> + struct device *dev = pdev->dev.parent;
>>> + struct pxa_w1_info *info = dev_get_drvdata(dev);
>>> +
>>> + clk_enable(info->clk);
>>> + dev_dbg(dev, "pxa DS1WM clk (active)\n");
>>> + return 0;
>>> +}
>>> +
>>> +static int ds1wm_disable(struct platform_device *pdev)
>>> +{
>>> + struct device *dev = pdev->dev.parent;
>>> + struct pxa_w1_info *info = dev_get_drvdata(dev);
>>> +
>>> + clk_disable(info->clk);
>>> + dev_dbg(dev, "pxa DS1WM clk (in-active)\n");
>>> + return 0;
>>> +}
>>> +
>>> +static struct resource ds1wm_resources[] __devinitdata = {
>>> + {0, 0, "ds1wm-mem", IORESOURCE_MEM,},
>>> + {0, 0, "ds1wm-irq", IORESOURCE_IRQ,},
>>> +};
>>> +
>>> +static struct ds1wm_driver_data ds1wm_pdata;
>>> +
>>> +static struct mfd_cell ds1wm_cell __devinitdata = {
>>> + .name = "ds1wm",
>>> + .enable = ds1wm_enable,
>>> + .disable = ds1wm_disable,
>>> + .platform_data =&ds1wm_pdata,
>>> + .pdata_size = sizeof(ds1wm_pdata),
>>> + .num_resources = ARRAY_SIZE(ds1wm_resources),
>>> + .resources = ds1wm_resources,
>>> +};
>>> +
>>> +static int __devinit pxa_w1_probe(struct platform_device *pdev)
>>> +{
>>> + struct ds1wm_driver_data *pdata = pdev->dev.platform_data;
>>> + struct pxa_w1_info *info;
>>> + struct resource *r;
>>> + int ret, irq;
>>> +
>>> + info = kzalloc(sizeof(struct pxa_w1_info), GFP_KERNEL);
>>> + if (!info)
>>> + return -ENOMEM;
>>> +
>>> + r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
>>> + if (r == NULL) {
>> Prefer to (!r) ?
>
> Why do you always stick to use !r? I like to use NULL since it's clear to me.
>
Use your habits and I just make a noise .
Thanks
>>> + ret = -ENXIO;
>>> + goto out;
>>> + }
>>> + irq = r->start;
>>> + if (pdata)
>>> + ds1wm_pdata.active_high = pdata->active_high;
>>> + if (ds1wm_pdata.active_high)
>>> + ds1wm_resources[1].flags |= IORESOURCE_IRQ_HIGHEDGE;
>>> + else
>>> + ds1wm_resources[1].flags |= IORESOURCE_IRQ_LOWEDGE;
>>> +
>>> + r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> + if (r == NULL) {
>> The same ?
>>> + ret = -ENXIO;
>>> + goto out;
>>> + }
>>> + ds1wm_resources[0].end = resource_size(r) - 1;
>>> +
>>> + info->clk = clk_get(&pdev->dev, NULL);
>>> + if (IS_ERR(info->clk)) {
>>> + ret = PTR_ERR(info->clk);
>>> + goto out;
>>> + }
>>> + platform_set_drvdata(pdev, info);
>>> +
>>> + ds1wm_pdata.clock_rate = clk_get_rate(info->clk);
>>> + ret = mfd_add_devices(&pdev->dev, pdev->id,&ds1wm_cell, 1, r,
>> irq);
>>> + if (ret< 0)
>>> + dev_err(&pdev->dev, "failed to register pxa DS1WM\n");
>>> +
>>> + return 0;
>>> +out:
>>> + kfree(info);
>>> + return ret;
>>> +}
>>> +
>>> +static int __devexit pxa_w1_remove(struct platform_device *pdev)
>>> +{
>>> + struct pxa_w1_info *info = platform_get_drvdata(pdev);
>>> +
>>> + mfd_remove_devices(&pdev->dev);
>>> + clk_put(info->clk);
>>> + kfree(info);
>>> + platform_set_drvdata(pdev, NULL);
>>> + return 0;
>>> +}
>>> +
>>> +static struct platform_driver pxa_w1_driver = {
>>> + .driver = {
>>> + .name = "pxa3xx-w1",
>>> + .owner = THIS_MODULE,
>>> + },
>>> + .probe = pxa_w1_probe,
>>> + .remove = __devexit_p(pxa_w1_remove),
>>> +};
>>> +
>>> +static int __init pxa_w1_base_init(void)
>>> +{
>>> + return platform_driver_register(&pxa_w1_driver);
>>> +}
>>> +
>>> +static void __exit pxa_w1_base_exit(void)
>>> +{
>>> + platform_driver_unregister(&pxa_w1_driver);
>>> +}
>>> +
>>> +module_init(pxa_w1_base_init);
>>> +module_exit(pxa_w1_base_exit);
>>> +
>>> +MODULE_AUTHOR("Jett Zhou<jtzhou@marvell.com>");
>>> +MODULE_DESCRIPTION("one wire driver for PXA");
>>> +MODULE_LICENSE("GPL");
>>> +MODULE_ALIAS("platform:pxa-w1");
>>
>> Best regards ,
>> Thanks
>>> --
>>> 1.5.6.5
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-
>> kernel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at http://www.tux.org/lkml/
>>>
next prev parent reply other threads:[~2011-04-14 14:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2011041301>
2011-04-13 14:50 ` 1. Replace mfd_data with platform_data for 88pm860x since mfd tree is upgraded Haojian Zhuang
2011-04-13 14:50 ` [PATCH 01/13] input: touchscreen: use polling mode in 88pm860x Haojian Zhuang
2011-04-13 14:50 ` [PATCH 02/13] input: touchscreen: move initialization " Haojian Zhuang
2011-04-13 14:50 ` [PATCH 03/13] rtc: add 88pm860x rtc Haojian Zhuang
2011-04-13 14:50 ` [PATCH 04/13] input: set the long press detection in 88pm860x onkey Haojian Zhuang
2011-04-13 14:50 ` [PATCH 05/13] w1: add DS278x slave driver Haojian Zhuang
2011-04-13 14:50 ` [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control + DS1WM chip Haojian Zhuang
2011-04-13 14:50 ` [PATCH 07/13] mfd: fix build warning on 88pm860x Haojian Zhuang
2011-04-13 14:50 ` [PATCH 08/13] mfd: use platform_data in max8925 Haojian Zhuang
2011-04-13 14:51 ` [PATCH 09/13] input: get irq from resource in max8925 onkey Haojian Zhuang
2011-04-13 14:51 ` [PATCH 10/13] rtc: avoid to use hardcoding irq number in max8925 Haojian Zhuang
2011-04-13 14:51 ` [PATCH 11/13] power_supply: max8925: use platform_data from cell Haojian Zhuang
2011-04-13 14:51 ` [PATCH 12/13] regulator: check name in initialization of max8925 Haojian Zhuang
2011-04-13 14:51 ` [PATCH 13/13] regulator: max8925: enable i2c sequence for control Haojian Zhuang
2011-04-16 18:02 ` Mark Brown
2011-04-16 18:01 ` [PATCH 12/13] regulator: check name in initialization of max8925 Mark Brown
2011-04-18 13:49 ` Haojian Zhuang
2011-04-13 15:03 ` [PATCH 11/13] power_supply: max8925: use platform_data from cell Anton Vorontsov
2011-04-14 2:26 ` Haojian Zhuang
2011-04-14 2:16 ` Haojian Zhuang
2011-04-15 0:41 ` [PATCH 10/13] rtc: avoid to use hardcoding irq number in max8925 Wanlong Gao
2011-04-15 0:35 ` [PATCH 08/13] mfd: use platform_data " Wanlong Gao
2011-04-14 14:17 ` [PATCH 06/13] mfd: pxa-w1: MFD driver for PXA 1wire control + DS1WM chip Wanlong Gao
2011-04-14 14:21 ` Haojian Zhuang
2011-04-14 14:29 ` Wanlong Gao [this message]
2011-04-14 14:02 ` [PATCH 01/13] input: touchscreen: use polling mode in 88pm860x Wanlong Gao
2011-04-14 14:41 ` Haojian Zhuang
2011-04-14 14:52 ` Wanlong Gao
2011-04-16 12:46 ` Haojian Zhuang
2011-04-16 13:17 ` Wanlong Gao
2011-04-16 14:17 ` Valdis.Kletnieks
2011-04-18 13:12 ` Haojian Zhuang
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=4DA704BD.7090501@gmail.com \
--to=wanlong.gao@gmail.com \
--cc=haojian.zhuang@gmail.com \
--cc=hzhuang1@marvell.com \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
/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.