From: Heiko Stuebner <heiko@sntech.de>
To: lee.jones@linaro.org
Cc: chenjh@rock-chips.com, devicetree@vger.kernel.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
Elaine Zhang <zhangqing@rock-chips.com>,
Heiko Stuebner <heiko@sntech.de>
Subject: [PATCH v9 RESEND 1/9] mfd: rk808: fix up the chip id get failed
Date: Mon, 21 Aug 2017 03:28:34 +0200 [thread overview]
Message-ID: <20170821012842.17875-2-heiko@sntech.de> (raw)
In-Reply-To: <20170821012842.17875-1-heiko@sntech.de>
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>
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
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 fd087cbb0bde..8e60ebaeaadb 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 83701ef7d3c7..54feb140c210 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,
--
2.14.1
next prev parent reply other threads:[~2017-08-21 1:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 1:28 [PATCH v9 RESEND 0/9] mfd: rk808: Add RK805 support Heiko Stuebner
2017-08-21 1:28 ` Heiko Stuebner [this message]
2017-08-21 8:14 ` [PATCH v9 RESEND 1/9] mfd: rk808: fix up the chip id get failed Lee Jones
2017-08-21 1:28 ` [PATCH v9 RESEND 3/9] regulator: rk808: Add regulator driver for RK805 Heiko Stuebner
2017-08-21 8:15 ` Lee Jones
[not found] ` <20170821012842.17875-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2017-08-21 1:28 ` [PATCH v9 RESEND 2/9] mfd: rk808: add rk805 regs addr and ID Heiko Stuebner
2017-08-21 8:15 ` Lee Jones
2017-08-21 1:28 ` [PATCH v9 RESEND 4/9] mfd: dt-bindings: Add RK805 device tree bindings document Heiko Stuebner
2017-08-21 8:15 ` Lee Jones
2017-08-21 1:28 ` [PATCH v9 RESEND 5/9] mfd: rk808: Add RK805 support Heiko Stuebner
2017-08-21 8:16 ` Lee Jones
2017-08-21 1:28 ` [PATCH v9 RESEND 9/9] mfd: rk808: Add RK805 power key support Heiko Stuebner
2017-08-21 8:16 ` Lee Jones
2017-08-21 1:28 ` [PATCH v9 RESEND 6/9] pinctrl: dt-bindings: add bindings for Rockchip RK805 PMIC Heiko Stuebner
2017-08-21 8:16 ` Lee Jones
2017-08-21 1:28 ` [PATCH v9 RESEND 7/9] pinctrl: Add pinctrl driver for the " Heiko Stuebner
[not found] ` <20170821012842.17875-8-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2017-08-21 8:16 ` Lee Jones
2017-08-21 1:28 ` [PATCH v9 RESEND 8/9] mfd: rk808: Add RK805 pinctrl support Heiko Stuebner
2017-08-21 8:16 ` Lee Jones
2017-08-21 8:25 ` [GIT PULL] Immutable branch between MFD, Pinctrl and Regulator due for the v4.14 merge window Lee Jones
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=20170821012842.17875-2-heiko@sntech.de \
--to=heiko@sntech.de \
--cc=chenjh@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--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).