From: Qiao Zhou <zhouqiao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
To: arnd-r2nGTMty4D4@public.gmane.org,
broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org,
rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org,
sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
chao.xie-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
yu.tang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
wilbur.wang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Qiao Zhou <zhouqiao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Subject: [PATCH 2/4 V5] mfd: workaround: add companion chip in 88pm80x
Date: Mon, 9 Jul 2012 14:37:33 +0800 [thread overview]
Message-ID: <1341815855-13522-3-git-send-email-zhouqiao@marvell.com> (raw)
In-Reply-To: <1341815855-13522-1-git-send-email-zhouqiao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
in hw design, 800 is mainly for pmic control, while 805 for audio.
but there are 3 registers which controls class D speaker property,
and they are defined in 800 i2c client domain. so 805 codec driver
needs to use 800 i2c client to access class D speaker reg for
audio path management. so add this workaround for the purpose to
let 805 access 800 i2c in some scenario.
Signed-off-by: Qiao Zhou <zhouqiao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
drivers/mfd/88pm80x.c | 28 ++++++++++++++++++++++++++++
include/linux/mfd/88pm80x.h | 1 +
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c
index 90aa18a..77b8655 100644
--- a/drivers/mfd/88pm80x.c
+++ b/drivers/mfd/88pm80x.c
@@ -18,6 +18,12 @@
#include <linux/uaccess.h>
#include <linux/err.h>
+/*
+ * workaround: some registers needed by pm805 are defined in pm800, so
+ * need to use this global variable to maintain the relation between
+ * pm800 and pm805. would remove it after HW chip fixes the issue.
+ */
+static struct pm80x_chip *g_pm80x_chip;
const struct regmap_config pm80x_regmap_config = {
.reg_bits = 8,
@@ -61,6 +67,19 @@ int __devinit pm80x_init(struct i2c_client *client,
device_init_wakeup(&client->dev, 1);
+ /*
+ * workaround: set g_pm80x_chip to the first probed chip. if the
+ * second chip is probed, just point to the companion to each
+ * other so that pm805 can access those specific register. would
+ * remove it after HW chip fixes the issue.
+ */
+ if (!g_pm80x_chip)
+ g_pm80x_chip = chip;
+ else {
+ chip->companion = g_pm80x_chip->client;
+ g_pm80x_chip->companion = chip->client;
+ }
+
return 0;
err_chip_id:
@@ -75,6 +94,15 @@ int __devexit pm80x_deinit(struct i2c_client *client)
{
struct pm80x_chip *chip = i2c_get_clientdata(client);
+ /*
+ * workaround: clear the dependency between pm800 and pm805.
+ * would remove it after HW chip fixes the issue.
+ */
+ if (g_pm80x_chip->companion)
+ g_pm80x_chip->companion = NULL;
+ else
+ g_pm80x_chip = NULL;
+
regmap_exit(chip->regmap);
devm_kfree(&client->dev, chip);
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index 6c126e9..103f06d 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -295,6 +295,7 @@ struct pm80x_chip {
struct pm80x_subchip *subchip;
struct device *dev;
struct i2c_client *client;
+ struct i2c_client *companion;
struct regmap *regmap;
struct regmap_irq_chip *regmap_irq_chip;
struct regmap_irq_chip_data *irq_data;
--
1.7.0.4
next prev parent reply other threads:[~2012-07-09 6:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 6:37 [PATCH 0/4 V5] add 88pm80x mfd driver Qiao Zhou
[not found] ` <1341815855-13522-1-git-send-email-zhouqiao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2012-07-09 6:37 ` [PATCH 1/4 V5] mfd: support 88pm80x in 80x driver Qiao Zhou
2012-07-09 6:37 ` Qiao Zhou [this message]
2012-07-09 6:37 ` [PATCH 3/4 V5] rtc: add rtc support to 88PM80X PMIC Qiao Zhou
2012-07-09 6:37 ` [PATCH 4/4 V5] input: add onkey " Qiao Zhou
2012-07-09 10:55 ` [PATCH 0/4 V5] add 88pm80x mfd driver Samuel Ortiz
2012-07-09 10:55 ` Mark Brown
[not found] ` <20120709105533.GA3934-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-07-09 13:21 ` Samuel Ortiz
2012-07-09 14:48 ` Qiao Zhou
2012-07-09 11:46 ` Arnd Bergmann
[not found] ` <201207091146.04093.arnd-r2nGTMty4D4@public.gmane.org>
2012-07-09 13:14 ` Samuel Ortiz
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=1341815855-13522-3-git-send-email-zhouqiao@marvell.com \
--to=zhouqiao-eyqppykdwxrbdgjk7y7tuq@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=chao.xie-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=wilbur.wang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=yu.tang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
/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).