mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
To: barebox@lists.infradead.org
Cc: andrey.gusakov@cogentembedded.com, cphealy@gmail.com
Subject: [PATCH 1/2] mfd: mc13xxx: add function returning mc13xxx type
Date: Fri,  6 Apr 2018 19:33:23 +0300	[thread overview]
Message-ID: <1523032404-7416-2-git-send-email-andrey.gusakov@cogentembedded.com> (raw)
In-Reply-To: <1523032404-7416-1-git-send-email-andrey.gusakov@cogentembedded.com>

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
---
 drivers/mfd/mc13xxx.c | 12 ++++++++++++
 include/mfd/mc13xxx.h | 10 ++++++++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index f6aa922..654313f 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -40,10 +40,12 @@ struct mc13xxx {
 		struct spi_device	*spi;
 	};
 	int				revision;
+	int				type;
 };
 
 struct mc13xxx_devtype {
 	int	(*revision)(struct mc13xxx*);
+	int	type;
 };
 
 #define to_mc13xxx(a)		container_of(a, struct mc13xxx, cdev)
@@ -56,6 +58,12 @@ struct mc13xxx *mc13xxx_get(void)
 }
 EXPORT_SYMBOL(mc13xxx_get);
 
+int mc13xxx_type(struct mc13xxx *mc13xxx)
+{
+	return mc13xxx->type;
+}
+EXPORT_SYMBOL(mc13xxx_type);
+
 int mc13xxx_revision(struct mc13xxx *mc13xxx)
 {
 	return mc13xxx->revision;
@@ -347,6 +355,7 @@ static int __init mc13xxx_probe(struct device_d *dev)
 	}
 
 	mc_dev->revision = rev;
+	mc_dev->type = devtype->type;
 
 	ret = regmap_register_cdev(mc_dev->map, NULL);
 	if (ret)
@@ -360,14 +369,17 @@ static int __init mc13xxx_probe(struct device_d *dev)
 
 static struct mc13xxx_devtype mc13783_devtype = {
 	.revision	= mc13783_revision,
+	.type		= MC13783_TYPE,
 };
 
 static struct mc13xxx_devtype mc13892_devtype = {
 	.revision	= mc13892_revision,
+	.type		= MC13892_TYPE,
 };
 
 static struct mc13xxx_devtype mc34708_devtype = {
 	.revision	= mc34708_revision,
+	.type		= MC34708_TYPE,
 };
 
 static struct platform_device_id mc13xxx_ids[] = {
diff --git a/include/mfd/mc13xxx.h b/include/mfd/mc13xxx.h
index d351c47..66ce2ea 100644
--- a/include/mfd/mc13xxx.h
+++ b/include/mfd/mc13xxx.h
@@ -16,6 +16,10 @@
 
 #define MC13XXX_REG_IDENTIFICATION	0x07
 
+#define MC13783_TYPE			1
+#define MC13892_TYPE			2
+#define MC34708_TYPE			3
+
 #define MC13783_REG_INT_STATUS0		0x00
 #define MC13783_REG_INT_MASK0		0x01
 #define MC13783_REG_INT_SENSE0		0x02
@@ -168,6 +172,7 @@ struct mc13xxx;
 
 #ifdef CONFIG_MFD_MC13XXX
 extern struct mc13xxx *mc13xxx_get(void);
+extern int mc13xxx_type(struct mc13xxx *mc13xxx);
 extern int mc13xxx_revision(struct mc13xxx *mc13xxx);
 extern int mc13xxx_reg_read(struct mc13xxx *mc13xxx, u8 reg, u32 *val);
 extern int mc13xxx_reg_write(struct mc13xxx *mc13xxx, u8 reg, u32 val);
@@ -179,6 +184,11 @@ static inline struct mc13xxx *mc13xxx_get(void)
 	return NULL;
 }
 
+static inline int mc13xxx_type(struct mc13xxx *mc13xxx)
+{
+	return -ENODEV;
+}
+
 static inline int mc13xxx_revision(struct mc13xxx *mc13xxx)
 {
 	return -ENODEV;
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-04-06 16:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06 16:33 [PATCH 0/2] mfd: mc13xxx: ADC support Andrey Gusakov
2018-04-06 16:33 ` Andrey Gusakov [this message]
2018-04-06 16:33 ` [PATCH 2/2] aiodev: mc13xxx: add adc support Andrey Gusakov
2018-04-10  7:06 ` [PATCH 0/2] mfd: mc13xxx: ADC support Sascha Hauer

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=1523032404-7416-2-git-send-email-andrey.gusakov@cogentembedded.com \
    --to=andrey.gusakov@cogentembedded.com \
    --cc=barebox@lists.infradead.org \
    --cc=cphealy@gmail.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