All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Tao" <huangtao@rock-chips.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: zhangqing <zhangqing@rock-chips.com>,
	heiko@sntech.de, lee.jones@linaro.org, zyw@rock-chips.com,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	rtc-linux@googlegroups.com
Subject: Re: [RESEND PATCH] rtc: rk808: rename rtc-rk808.c to rtc-rk8xx.c
Date: Tue, 5 Jan 2016 16:31:38 +0800	[thread overview]
Message-ID: <568B7F6A.3000607@rock-chips.com> (raw)
In-Reply-To: <20160104145938.6c053b5a@linux.lan.towertech.it>

Hi, Alessandro:

On 2016年01月04日 21:59, Alessandro Zummo wrote:
> On Mon, 4 Jan 2016 10:45:46 +0100
> Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
> 
>> I'm not sure it is useful to do that renaming. It is usual to have one
>> driver that supports multiple chips named with the forst chip it
>> supported.
>>
>> Also, what would happen if for example rk855 is not compatible at all
>> with the previous implementations?
> 
>  Alexandre is absolutely right. There's no need to rename a driver,
>  it would just piss off people who are used to that name and
>  have it in their scripts. Like when your eth0 gets renamed
>  to some obscure enXXX <g>.
> 

You and Alexandre are right. The rename is just make the driver more
readable, i.e. let people know this driver suit for more PMIC no just
rk808. In fact, I don't care the name is rk808 or rk8xx.

The key change of this patch is try to dis-coupling rk808 driver and RTC
driver. Because of register offset and function is vary between
different PMIC, we believe it is hard to write one PMIC driver to suit
all PMIC. So we hope RTC driver can share between all PMIC from rockchip.

Please review this code:

-static int rk808_rtc_probe(struct platform_device *pdev)
+static int rk8xx_rtc_probe(struct platform_device *pdev)
 {
-	struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
	...
+	struct i2c_client *client = to_i2c_client(pdev->dev.parent);

	...

-	rk808_rtc->rk808 = rk808;
+	rk8xx_rtc->regmap = devm_regmap_init_i2c(client,
+					     &rk8xx_rtc_regmap_config);
	...
+	rk8xx_rtc->i2c = client;

Old driver have struct rk808 pointer, which defined on
include/linux/mfd/rk808.h
If we write new PMIC driver, for example rk818, define a new struct
rk818. How can we get this pointer from RTC driver?

So another way to solve this problem is introduce common struct share
between all PMIC driver. For example rk8xx.

We solve this problem by create new regmap to access PMIC. As I say
before, it make RTC driver independent of PMIC driver. Do you agree this
change?

Thanks!
Huang, Tao

WARNING: multiple messages have this Message-ID (diff)
From: "Huang, Tao" <huangtao@rock-chips.com>
To: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: zhangqing <zhangqing@rock-chips.com>,
	heiko@sntech.de, lee.jones@linaro.org, zyw@rock-chips.com,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	rtc-linux@googlegroups.com
Subject: [rtc-linux] Re: [RESEND PATCH] rtc: rk808: rename rtc-rk808.c to rtc-rk8xx.c
Date: Tue, 5 Jan 2016 16:31:38 +0800	[thread overview]
Message-ID: <568B7F6A.3000607@rock-chips.com> (raw)
In-Reply-To: <20160104145938.6c053b5a@linux.lan.towertech.it>

Hi, Alessandro:

On 2016=E5=B9=B401=E6=9C=8804=E6=97=A5 21:59, Alessandro Zummo wrote:
> On Mon, 4 Jan 2016 10:45:46 +0100
> Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:
>=20
>> I'm not sure it is useful to do that renaming. It is usual to have one
>> driver that supports multiple chips named with the forst chip it
>> supported.
>>
>> Also, what would happen if for example rk855 is not compatible at all
>> with the previous implementations?
>=20
>  Alexandre is absolutely right. There's no need to rename a driver,
>  it would just piss off people who are used to that name and
>  have it in their scripts. Like when your eth0 gets renamed
>  to some obscure enXXX <g>.
>=20

You and Alexandre are right. The rename is just make the driver more
readable, i.e. let people know this driver suit for more PMIC no just
rk808. In fact, I don't care the name is rk808 or rk8xx.

The key change of this patch is try to dis-coupling rk808 driver and RTC
driver. Because of register offset and function is vary between
different PMIC, we believe it is hard to write one PMIC driver to suit
all PMIC. So we hope RTC driver can share between all PMIC from rockchip.

Please review this code:

-static int rk808_rtc_probe(struct platform_device *pdev)
+static int rk8xx_rtc_probe(struct platform_device *pdev)
 {
-	struct rk808 *rk808 =3D dev_get_drvdata(pdev->dev.parent);
	...
+	struct i2c_client *client =3D to_i2c_client(pdev->dev.parent);

	...

-	rk808_rtc->rk808 =3D rk808;
+	rk8xx_rtc->regmap =3D devm_regmap_init_i2c(client,
+					     &rk8xx_rtc_regmap_config);
	...
+	rk8xx_rtc->i2c =3D client;

Old driver have struct rk808 pointer, which defined on
include/linux/mfd/rk808.h
If we write new PMIC driver, for example rk818, define a new struct
rk818. How can we get this pointer from RTC driver?

So another way to solve this problem is introduce common struct share
between all PMIC driver. For example rk8xx.

We solve this problem by create new regmap to access PMIC. As I say
before, it make RTC driver independent of PMIC driver. Do you agree this
change?

Thanks!
Huang, Tao

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  reply	other threads:[~2016-01-05  8:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-31 14:14 [RESEND PATCH] rtc: rk808: rename rtc-rk808.c to rtc-rk8xx.c zhangqing
2015-12-31 14:14 ` [rtc-linux] " zhangqing
2016-01-04  9:14 ` Kever Yang
2016-01-04  9:14   ` [rtc-linux] " Kever Yang
2016-01-04  9:45 ` Alexandre Belloni
2016-01-04  9:45   ` [rtc-linux] " Alexandre Belloni
     [not found]   ` <20160104094546.GB32724-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2016-01-04 13:59     ` Alessandro Zummo
2016-01-04 13:59       ` Alessandro Zummo
2016-01-04 13:59       ` [rtc-linux] " Alessandro Zummo
2016-01-05  8:31       ` Huang, Tao [this message]
2016-01-05  8:31         ` Huang, Tao
2016-01-05  8:54         ` Alexandre Belloni
2016-01-05  8:54           ` [rtc-linux] " Alexandre Belloni

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=568B7F6A.3000607@rock-chips.com \
    --to=huangtao@rock-chips.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=heiko@sntech.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=zhangqing@rock-chips.com \
    --cc=zyw@rock-chips.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.