From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965380AbbD1LNk (ORCPT ); Tue, 28 Apr 2015 07:13:40 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:33594 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965323AbbD1LNj (ORCPT ); Tue, 28 Apr 2015 07:13:39 -0400 Date: Tue, 28 Apr 2015 12:13:34 +0100 From: Lee Jones To: "Pallala, Ramakrishna" Cc: "linux-kernel@vger.kernel.org" , Chanwoo Choi , Samuel Ortiz , Jacob Pan Subject: Re: [PATCH v5] extcon-axp288: Add axp288 extcon driver support Message-ID: <20150428111334.GQ11956@x1> References: <1430237638-16686-1-git-send-email-ramakrishna.pallala@intel.com> <20150428100442.GM11956@x1> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > --- > > > 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 > > > + * > > > + * 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 > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > [snip] > > > > +module_platform_driver(axp288_extcon_driver); > > > + > > > +MODULE_AUTHOR("Ramakrishna Pallala "); > > > +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