All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: "Pallala, Ramakrishna" <ramakrishna.pallala@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: Re: [PATCH v5] extcon-axp288: Add axp288 extcon driver support
Date: Tue, 28 Apr 2015 12:13:34 +0100	[thread overview]
Message-ID: <20150428111334.GQ11956@x1> (raw)
In-Reply-To: <D854C92F57B1B347B57E531E78D05EAD57822173@BGSMSX104.gar.corp.intel.com>

On Tue, 28 Apr 2015, Pallala, Ramakrishna wrote:

> > > This patch adds the extcon support for AXP288 PMIC which has the BC1.2
> > > charger detection capability. Additionally it also adds the USB mux
> > > switching support b/w SOC and PMIC based on GPIO control.
> > >
> > > Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
> > > ---
> > >  drivers/extcon/Kconfig         |    7 +
> > >  drivers/extcon/Makefile        |    1 +
> > >  drivers/extcon/extcon-axp288.c |  399
> > ++++++++++++++++++++++++++++++++++++++++
> > >  include/linux/mfd/axp20x.h     |    9 +
> > >  4 files changed, 416 insertions(+)
> > >  create mode 100644 drivers/extcon/extcon-axp288.c
> > >
> > > diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig index
> > > fdc0bf0..2305edc 100644
> > > --- a/drivers/extcon/Kconfig
> > > +++ b/drivers/extcon/Kconfig
> > > @@ -28,6 +28,13 @@ config EXTCON_ARIZONA
> > >  	  with Wolfson Arizona devices. These are audio CODECs with
> > >  	  advanced audio accessory detection support.
> > >
> > > +config EXTCON_AXP288
> > > +	tristate "X-Power AXP288 EXTCON support"
> > > +	depends on MFD_AXP20X && USB_PHY
> > > +	help
> > > +	  Say Y here to enable support for USB peripheral detection
> > > +	  and USB MUX switching by X-Power AXP288 PMIC.
> > > +
> > >  config EXTCON_GPIO
> > >  	tristate "GPIO extcon support"
> > >  	depends on GPIOLIB
> > > diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile index
> > > 9204114..ba787d0 100644
> > > --- a/drivers/extcon/Makefile
> > > +++ b/drivers/extcon/Makefile
> > > @@ -5,6 +5,7 @@
> > >  obj-$(CONFIG_EXTCON)		+= extcon.o
> > >  obj-$(CONFIG_EXTCON_ADC_JACK)	+= extcon-adc-jack.o
> > >  obj-$(CONFIG_EXTCON_ARIZONA)	+= extcon-arizona.o
> > > +obj-$(CONFIG_EXTCON_AXP288)	+= extcon-axp288.o
> > >  obj-$(CONFIG_EXTCON_GPIO)	+= extcon-gpio.o
> > >  obj-$(CONFIG_EXTCON_MAX14577)	+= extcon-max14577.o
> > >  obj-$(CONFIG_EXTCON_MAX77693)	+= extcon-max77693.o
> > > diff --git a/drivers/extcon/extcon-axp288.c
> > > b/drivers/extcon/extcon-axp288.c new file mode 100644 index
> > > 0000000..91d764c
> > > --- /dev/null
> > > +++ b/drivers/extcon/extcon-axp288.c
> > > @@ -0,0 +1,399 @@
> > > +/*
> > > + * extcon-axp288.c - X-Power AXP288 PMIC extcon cable detection
> > > +driver
> > > + *
> > > + * Copyright (C) 2014 Intel Corporation
> > > + * Author: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
> > > + *
> > > + * This program is free software; you can redistribute it and/or
> > > +modify
> > > + * it under the terms of the GNU General Public License version 2 as
> > > + * published by the Free Software Foundation.
> > > + *
> > > + * This program is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > > + * GNU General Public License for more details.
> > > + */
> > > +
> > > +#include <linux/module.h>
> > > +#include <linux/kernel.h>
> > > +#include <linux/io.h>
> > > +#include <linux/slab.h>
> > > +#include <linux/interrupt.h>
> > > +#include <linux/platform_device.h>
> > > +#include <linux/property.h>
> > > +#include <linux/usb/phy.h>
> > > +#include <linux/notifier.h>
> > > +#include <linux/extcon.h>
> > > +#include <linux/regmap.h>
> > > +#include <linux/gpio.h>
> > > +#include <linux/gpio/consumer.h>
> > > +#include <linux/mfd/axp20x.h>
> 
> [snip]
> 
> > > +module_platform_driver(axp288_extcon_driver);
> > > +
> > > +MODULE_AUTHOR("Ramakrishna Pallala <ramakrishna.pallala@intel.com>");
> > > +MODULE_DESCRIPTION("X-Powers AXP288 extcon driver");
> > > +MODULE_LICENSE("GPL v2");
> > > diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> > > index dfabd6d..81152e2 100644
> > > --- a/include/linux/mfd/axp20x.h
> > > +++ b/include/linux/mfd/axp20x.h
> > > @@ -275,4 +275,13 @@ struct axp20x_fg_pdata {
> > >  	int thermistor_curve[MAX_THERM_CURVE_SIZE][2];
> > >  };
> > >
> > > +#define AXP288_EXTCON_CABLE_SDP		"SLOW-CHARGER"
> > > +#define AXP288_EXTCON_CABLE_CDP		"CHARGE-
> > DOWNSTREAM"
> > > +#define AXP288_EXTCON_CABLE_DCP		"FAST-CHARGER"
> > 
> > #defines are meant to make things *easier* for humans to read. It is my opinion
> > that these negatively impact the readability of the code.
> These macros will be used in extcon and charger drivers. How can I make it more readable?

If the things you're defining are more readable than the defines
themselves you're doing the opposite of what I'd expect.

How about:

  AXP288_EXTCON_SLOW_CHARGER_CABLE
  AXP288_EXTCON_FAST_CHARGER_CABLE
  AXP288_EXTCON_CHARGE_DOWNSTREAM_CABLE

> > > +struct axp288_extcon_pdata {
> > > +	/* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */
> > > +	struct gpio_desc *gpio_mux_cntl;
> > > +};
> > 
> > Are you going to add to this?
> Yes, this is needed.
> 
> Thanks,
> Ram

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2015-04-28 11:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 16:13 [PATCH v5] extcon-axp288: Add axp288 extcon driver support Ramakrishna Pallala
2015-04-28 10:04 ` Lee Jones
2015-04-28 10:10   ` Pallala, Ramakrishna
2015-04-28 11:13     ` Lee Jones [this message]
2015-04-28 11:20       ` Pallala, Ramakrishna
2015-04-28 11:33         ` Chanwoo Choi
2015-04-28 12:17           ` Pallala, Ramakrishna
2015-04-28 13:02             ` Chanwoo Choi
2015-04-28 13:18               ` Pallala, Ramakrishna

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=20150428111334.GQ11956@x1 \
    --to=lee.jones@linaro.org \
    --cc=cw00.choi@samsung.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ramakrishna.pallala@intel.com \
    --cc=sameo@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.