From: Jianhong Chen <chenjh@rock-chips.com>
To: gnurou@gmail.com, linus.walleij@linaro.org, dmitry.torokhov@gmail.com
Cc: linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
huangtao@rock-chips.com, tony.xie@rock-chips.com,
zhangqing@rock-chips.com, devicetree@vger.kernel.org,
w.egorov@phytec.de, lgirdwood@gmail.com, broonie@kernel.org,
robh+dt@kernel.org, mark.rutland@arm.com,
linux-gpio@vger.kernel.org, linux-input@vger.kernel.org
Subject: [PATCH v6 01/12] mfd: rk808: fix up the chip id get failed
Date: Thu, 8 Jun 2017 15:12:28 +0800 [thread overview]
Message-ID: <1496905959-29202-2-git-send-email-chenjh@rock-chips.com> (raw)
In-Reply-To: <1496905959-29202-1-git-send-email-chenjh@rock-chips.com>
From: Elaine Zhang <zhangqing@rock-chips.com>
the rk8xx chip id is:
((MSB << 8) | LSB) & 0xfff0
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
---
drivers/mfd/rk808.c | 21 +++++++++++++++------
include/linux/mfd/rk808.h | 1 +
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index fd087cb..3334a2a 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -325,7 +325,7 @@ static int rk808_probe(struct i2c_client *client,
void (*pm_pwroff_fn)(void);
int nr_pre_init_regs;
int nr_cells;
- int pm_off = 0;
+ int pm_off = 0, msb, lsb;
int ret;
int i;
@@ -333,14 +333,23 @@ static int rk808_probe(struct i2c_client *client,
if (!rk808)
return -ENOMEM;
- rk808->variant = i2c_smbus_read_word_data(client, RK808_ID_MSB);
- if (rk808->variant < 0) {
- dev_err(&client->dev, "Failed to read the chip id at 0x%02x\n",
+ /* read Chip variant */
+ msb = i2c_smbus_read_byte_data(client, RK808_ID_MSB);
+ if (msb < 0) {
+ dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
RK808_ID_MSB);
- return rk808->variant;
+ return msb;
}
- dev_dbg(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
+ lsb = i2c_smbus_read_byte_data(client, RK808_ID_LSB);
+ if (lsb < 0) {
+ dev_err(&client->dev, "failed to read the chip id at 0x%x\n",
+ RK808_ID_LSB);
+ return lsb;
+ }
+
+ rk808->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK;
+ dev_info(&client->dev, "Chip id: 0x%x\n", (unsigned int)rk808->variant);
switch (rk808->variant) {
case RK808_ID:
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 83701ef..54feb14 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -298,6 +298,7 @@ enum rk818_reg {
#define VOUT_LO_INT BIT(0)
#define CLK32KOUT2_EN BIT(0)
+#define RK8XX_ID_MSK 0xfff0
enum {
BUCK_ILMIN_50MA,
BUCK_ILMIN_100MA,
--
1.9.1
next prev parent reply other threads:[~2017-06-08 7:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 7:12 [PATCH v6 00/12] rk808: Add RK805 support Jianhong Chen
2017-06-08 7:12 ` Jianhong Chen [this message]
2017-06-08 7:12 ` [PATCH v6 04/12] mfd: " Jianhong Chen
2017-06-08 7:27 ` [PATCH v6 05/12] clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808 Jianhong Chen
2017-06-08 7:28 ` [PATCH v6 07/12] mfd: dt-bindings: Add RK805 device tree bindings document Jianhong Chen
2017-06-08 19:27 ` Rob Herring
2017-06-08 7:30 ` [PATCH v6 08/12] gpio: Add GPIO driver for the RK805 PMIC Jianhong Chen
2017-06-09 11:37 ` Linus Walleij
2017-06-09 12:17 ` Heiko Stuebner
2017-06-14 12:11 ` Jianhong Chen
2017-06-29 10:29 ` Heiko Stübner
2017-07-21 2:00 ` Jianhong Chen
2017-07-21 8:12 ` Heiko Stuebner
[not found] ` <1496905959-29202-1-git-send-email-chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-08 7:12 ` [PATCH v6 02/12] mfd: rk808: add rk805 regs addr and ID Jianhong Chen
2017-06-08 7:12 ` [PATCH v6 03/12] regulator: rk808: Add regulator driver for RK805 Jianhong Chen
[not found] ` <1496905959-29202-4-git-send-email-chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-08 11:11 ` Mark Brown
2017-06-08 7:28 ` [PATCH v6 06/12] rtc: Kconfig: Name RK805 in Kconfig for RTC_DRV_RK808 Jianhong Chen
2017-06-08 7:30 ` [PATCH v6 09/12] Input: Add power key driver for Rockchip RK805 PMIC Jianhong Chen
[not found] ` <1496907027-27197-1-git-send-email-chenjh-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-06-20 3:06 ` Dmitry Torokhov
2017-06-08 7:31 ` [PATCH v6 10/12] mfd: rk808: Add RK805 gpio support Jianhong Chen
2017-06-08 7:33 ` [PATCH v6 12/12] gpio: dt-bindings: add bindings for Rockchip RK805 PMIC Jianhong Chen
2017-06-09 11:30 ` Linus Walleij
2017-06-12 15:58 ` Rob Herring
2017-06-08 7:32 ` [PATCH v6 11/12] mfd: rk808: Add RK805 power key support Jianhong Chen
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=1496905959-29202-2-git-send-email-chenjh@rock-chips.com \
--to=chenjh@rock-chips.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gnurou@gmail.com \
--cc=huangtao@rock-chips.com \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--cc=tony.xie@rock-chips.com \
--cc=w.egorov@phytec.de \
--cc=zhangqing@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).