Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1660820

[PATCH v6 01/12] mfd: rk808: fix up the chip id get failed

From Jianhong Chen <chenjh@rock-chips.com>
Newsgroups linux.kernel
Subject [PATCH v6 01/12] mfd: rk808: fix up the chip id get failed
Date 2017-06-08 09:20 +0200
Message-ID <tPZTA-1ak-19@gated-at.bofh.it> (permalink)
References <tPZTA-1ak-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v6 00/12] rk808: Add RK805 support Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:20 +0200
  [PATCH v6 01/12] mfd: rk808: fix up the chip id get failed Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:20 +0200
  [PATCH v6 03/12] regulator: rk808: Add regulator driver for RK805 Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:20 +0200
    Re: [PATCH v6 03/12] regulator: rk808: Add regulator driver for RK805 Mark Brown <broonie@kernel.org> - 2017-06-08 13:20 +0200
  [PATCH v6 04/12] mfd: rk808: Add RK805 support Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:20 +0200
  [PATCH v6 05/12] clk: Kconfig: Name RK805 in Kconfig for COMMON_CLK_RK808 Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:30 +0200
  [PATCH v6 11/12] mfd: rk808: Add RK805 power key support Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:40 +0200
  [PATCH v6 06/12] rtc: Kconfig: Name RK805 in Kconfig for RTC_DRV_RK808 Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:40 +0200
  [PATCH v6 12/12] gpio: dt-bindings: add bindings for Rockchip RK805 PMIC Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:40 +0200
    Re: [PATCH v6 12/12] gpio: dt-bindings: add bindings for Rockchip  RK805 PMIC Linus Walleij <linus.walleij@linaro.org> - 2017-06-09 13:40 +0200
    Re: [PATCH v6 12/12] gpio: dt-bindings: add bindings for Rockchip  RK805 PMIC Rob Herring <robh@kernel.org> - 2017-06-12 18:00 +0200
  [PATCH v6 10/12] mfd: rk808: Add RK805 gpio support Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:40 +0200
  [PATCH v6 08/12] gpio: Add GPIO driver for the RK805 PMIC Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:40 +0200
    Re: [PATCH v6 08/12] gpio: Add GPIO driver for the RK805 PMIC Linus Walleij <linus.walleij@linaro.org> - 2017-06-09 13:40 +0200
      Re: [PATCH v6 08/12] gpio: Add GPIO driver for the RK805 PMIC Heiko Stuebner <heiko@sntech.de> - 2017-06-09 14:20 +0200
        Re: [PATCH v6 08/12] gpio: Add GPIO driver for the RK805 PMIC Jianhong Chen <chenjh@rock-chips.com> - 2017-06-14 14:10 +0200
  [PATCH v6 09/12] Input: Add power key driver for Rockchip RK805 PMIC Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:40 +0200
  [PATCH v6 07/12] mfd: dt-bindings: Add RK805 device tree bindings document Jianhong Chen <chenjh@rock-chips.com> - 2017-06-08 09:40 +0200
    Re: [PATCH v6 07/12] mfd: dt-bindings: Add RK805 device tree  bindings document Rob Herring <robh@kernel.org> - 2017-06-08 21:30 +0200

csiph-web