public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] MFD: MAX8997: add platform data for MAX8997 MUIC driver
@ 2011-11-24  9:12 Donggeun Kim
  2011-11-24  9:12 ` [PATCH 2/2] misc: add driver support for MAX8997 MUIC Donggeun Kim
  2011-12-12 17:06 ` [PATCH 1/2] MFD: MAX8997: add platform data for MAX8997 MUIC driver Samuel Ortiz
  0 siblings, 2 replies; 11+ messages in thread
From: Donggeun Kim @ 2011-11-24  9:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: sameo, broonie, gregkh, akpm, kyungmin.park, myungjoo.ham,
	dg77.kim

Currently, MAX8997 device does not support MUIC function of it.
To add MAX8997 MUIC driver, header file should be updated.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 include/linux/mfd/max8997.h |   58 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 0bbd13d..49d2a0b 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -77,6 +77,60 @@ struct max8997_regulator_data {
 	struct regulator_init_data *initdata;
 };
 
+enum max8997_muic_usb_type {
+	MAX8997_USB_HOST,
+	MAX8997_USB_DEVICE,
+};
+
+enum max8997_muic_charger_type {
+	MAX8997_CHARGER_TYPE_NONE = 0,
+	MAX8997_CHARGER_TYPE_USB,
+	MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT,
+	MAX8997_CHARGER_TYPE_DEDICATED_CHG,
+	MAX8997_CHARGER_TYPE_500MA,
+	MAX8997_CHARGER_TYPE_1A,
+	MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7,
+};
+
+struct max8997_muic_reg_data {
+	u8 addr;
+	u8 data;
+};
+
+/**
+ * struct max8997_muic_platform_data
+ * @usb_callback: callback function for USB
+ *		  inform callee of USB type (HOST or DEVICE)
+ *		  and attached state(true or false)
+ * @charger_callback: callback function for charger
+ *		  inform callee of charger_type
+ *		  and attached state(true or false)
+ * @deskdock_callback: callback function for desk dock
+ *		  inform callee of attached state(true or false)
+ * @cardock_callback: callback function for car dock
+ *		  inform callee of attached state(true or false)
+ * @mhl_callback: callback function for MHL (Mobile High-definition Link)
+ *		  inform callee of attached state(true or false)
+ * @uart_callback: callback function for JIG UART
+ *		   inform callee of attached state(true or false)
+ * @init_data: array of max8997_muic_reg_data
+ *	       used for initializing registers of MAX8997 MUIC device
+ * @num_init_data: array size of init_data
+ */
+struct max8997_muic_platform_data {
+	void (*usb_callback)(enum max8997_muic_usb_type usb_type,
+		bool attached);
+	void (*charger_callback)(bool attached,
+		enum max8997_muic_charger_type charger_type);
+	void (*deskdock_callback) (bool attached);
+	void (*cardock_callback) (bool attached);
+	void (*mhl_callback) (bool attached);
+	void (*uart_callback) (bool attached);
+
+	struct max8997_muic_reg_data *init_data;
+	int num_init_data;
+};
+
 struct max8997_platform_data {
 	/* IRQ */
 	int irq_base;
@@ -113,7 +167,9 @@ struct max8997_platform_data {
 	/* charge Full Timeout */
 	int timeout; /* 0 (no timeout), 5, 6, 7 hours */
 
-	/* MUIC: Not implemented */
+	/* ---- MUIC ---- */
+	struct max8997_muic_platform_data *muic_pdata;
+
 	/* HAPTIC: Not implemented */
 	/* RTC: Not implemented */
 	/* Flash: Not implemented */
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread
* Re: Re: [PATCH 2/2] misc: add driver support for MAX8997 MUIC
@ 2011-12-15  0:32 MyungJoo Ham
  2011-12-15 15:34 ` Arnd Bergmann
  0 siblings, 1 reply; 11+ messages in thread
From: MyungJoo Ham @ 2011-12-15  0:32 UTC (permalink / raw)
  To: Arnd Bergmann, Samuel Ortiz
  Cc: 김동근, linux-kernel@vger.kernel.org,
	broonie@opensource.wolfsonmicro.com, gregkh@suse.de,
	akpm@linux-foundation.org, 박경민

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2239 bytes --]

> On Monday 12 December 2011, Samuel Ortiz wrote:
> > On Thu, Nov 24, 2011 at 06:12:18PM +0900, Donggeun Kim wrote:
> > > The MUIC function in MAX8997 device can be used as
> > > a USB port detector and switch.
> > > This patch supports the MUIC feature of MAX8997.
> > 
> > I'm queueing this one to my for-next branch as it depends on your previous MFD
> > patch.
> > I'm also cc'ing Arnd in case he has some objections.
> 
> Thanks for the notification!
> 
> First of all, every new user space interface including new sysfs files
> and uevent messages needs documentation in the Documentation/ABI
> directory.
> 
> The part that is not clear to me is how this new driver fits in
> with the first fsa9480 driver and the currently discussed extcon
> subsystem, apparently all written by the same team at Samsung.
> Is this misc driver still useful when the extcon framework gets
> merged?

When extcom gets merged, this driver should be updated. It looks like allowing the interrupt handler to update extcon state would be enough. Bascially, this is all this driver is required for extcon to work. (and the prvious author of extcon--"extended" switch class at that time--was the author of this patch.)

Anyway, this patch has just told me that I'll need to add more sysfs entries for extcon to show the list of cable names and/or to show the status for each of them, soon or later.

> 
> I very much believe that we should avoid introducing user interfaces
> in a driver specific way when we have multiple pieces of hardware
> that try to do the same thing. The extcon subsystem seems to handle
> this correctly on the high-level (I have not done a detailed
> review yet but I trust that it will be ok), so I don't understand
> why we want another driver for the MAX8997 MUIC.

This sysfs entry is a bit confusing to me (that userspace may update this CONTROL register). I'll consult Donggeun when he arrives and will write again about this one. If it is not writable, this is supported by extcon framework, so this sysfs entry will disappear adapting extcon.


Cheers!
MyungJoo
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Re: [PATCH 2/2] misc: add driver support for MAX8997 MUIC
@ 2011-12-16  5:13 함명주
  2011-12-16 13:58 ` Arnd Bergmann
  0 siblings, 1 reply; 11+ messages in thread
From: 함명주 @ 2011-12-16  5:13 UTC (permalink / raw)
  To: Samuel Ortiz, Arnd Bergmann
  Cc: 김동근, linux-kernel@vger.kernel.org,
	broonie@opensource.wolfsonmicro.com, gregkh@suse.de,
	akpm@linux-foundation.org, 박경민

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2882 bytes --]

Samuel Ortiz<sameo@linux.intel.com> wrote:
> Hi Arnd,
> On Thu, Dec 15, 2011 at 03:34:01PM +0000, Arnd Bergmann wrote:
> > On Thursday 15 December 2011, MyungJoo Ham wrote:
> > > Arnd Bergmann wrote:
> > > > On Monday 12 December 2011, Samuel Ortiz wrote:
> > > > The part that is not clear to me is how this new driver fits in
> > > > with the first fsa9480 driver and the currently discussed extcon
> > > > subsystem, apparently all written by the same team at Samsung.
> > > > Is this misc driver still useful when the extcon framework gets
> > > > merged?
> > > 
> > > When extcom gets merged, this driver should be updated. It looks like allowing
> > > the interrupt handler to update extcon state would be enough. Bascially, this
> > > is all this driver is required for extcon to work. (and the prvious author of
> > > extcon--"extended" switch class at that time--was the author of this patch.)
> > > 
> > > Anyway, this patch has just told me that I'll need to add more sysfs entries
> > > for extcon to show the list of cable names and/or to show the status for each
> > > of them, soon or later.
> > 
> > I think it would be better not to merge this driver until the user interface
> > in the extcon framework has been finalized. I don't mind the driver, but I
> > want to prevent user interfaces from appearing in the kernel that we
> > intend to change anyway.
> > 
> > How about dropping the driver from the mfd tree, and adding it into the
> > extcon series for the next posting?
> Sounds good to me, I'll drop it.
> 
> Cheers,
> Samuel.
> 

To wait for extcon get merged and keep the MAX8997-MUIC without any sysfs interfaces or extcon feature, the following patch has been submitted yesterday:

http://lkml.org/lkml/2011/12/15/123

[PATCH] misc: max8997-muic: remove sysfs attribute
> The 'switch' sysfs attribute is used for
> showing and setting the switch state of the device.
> However, setting it from the userspace focibly is not appropriate.
> And showing the state can be handled from
> other places (e.g. external connector) in a unified manner.
> This patch removes the sysfs attribute.
> Plus, uevent messages for interrupts are also removed.
> 
> The initial max8997-muic driver is merged at:
> git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6.git for-next
> 
> Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>

We can send the patch (with extcon support) later anyway if it's going to be dropped for now.

And, this MAX8997-MUIC will be the example driver for extcon located at /drivers/extcon/.


Cheers!
MyungJoo.ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-12-16 13:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24  9:12 [PATCH 1/2] MFD: MAX8997: add platform data for MAX8997 MUIC driver Donggeun Kim
2011-11-24  9:12 ` [PATCH 2/2] misc: add driver support for MAX8997 MUIC Donggeun Kim
2011-11-28 23:48   ` Andrew Morton
2011-11-29  0:02     ` Kyungmin Park
2011-11-29  9:59     ` Samuel Ortiz
2011-12-12 17:08   ` Samuel Ortiz
2011-12-14 16:35     ` Arnd Bergmann
2011-12-12 17:06 ` [PATCH 1/2] MFD: MAX8997: add platform data for MAX8997 MUIC driver Samuel Ortiz
  -- strict thread matches above, loose matches on Subject: below --
2011-12-15  0:32 Re: [PATCH 2/2] misc: add driver support for MAX8997 MUIC MyungJoo Ham
2011-12-15 15:34 ` Arnd Bergmann
2011-12-15 17:25   ` Samuel Ortiz
2011-12-16  5:13 함명주
2011-12-16 13:58 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox