Re: [PATCH] arm: omap: reduce zImage size on omap2plus_defconfig

2014-12-24 Thread Igor Grinberg
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/23/14 18:19, Felipe Balbi wrote:
 On Tue, Dec 23, 2014 at 09:30:45AM +0200, Igor Grinberg wrote:
 Hi Felipe,

 On 12/22/14 20:05, Felipe Balbi wrote:

 [...]

  CONFIG_SCSI_SCAN_ASYNC=y
 -CONFIG_ATA=y
 -CONFIG_SATA_AHCI_PLATFORM=y
 -CONFIG_MD=y
 +CONFIG_ATA=m
 +CONFIG_SATA_AHCI_PLATFORM=m

 Isn't this needed for the rootfs on SATA devices?
 
 there's no known boards with rootfs on SATA. Until then, we can reduce
 the size.

What makes you say so?
The decision for rootfs on SATA is taken dynamically.
OMAP5 boards (specifically cm-t54) can have rootfs on SATA...

 
  CONFIG_NETDEVICES=y
  # CONFIG_NET_VENDOR_ARC is not set
  # CONFIG_NET_CADENCE is not set
 @@ -154,8 +151,8 @@ CONFIG_TI_CPSW=y
  # CONFIG_NET_VENDOR_WIZNET is not set
  CONFIG_AT803X_PHY=y
  CONFIG_SMSC_PHY=y
 -CONFIG_USB_USBNET=y
 -CONFIG_USB_NET_SMSC95XX=y
 +CONFIG_USB_USBNET=m
 +CONFIG_USB_NET_SMSC95XX=m

 What about the NFS root for boards with only USB eth?
 
 USB is a module already and it breaks PM when enabled.

Well, USB is not a module currently, but after reading below
I understand you mean HCDs are either disabled or modules.
Ok that's fine with me.

[...]

 -CONFIG_USB=y
 +CONFIG_HID_GENERIC=m
 +CONFIG_USB_HIDDEV=y
 +CONFIG_USB_KBD=m
 +CONFIG_USB_MOUSE=m
 +CONFIG_USB=m

 So, you don't consider USB a valid rootfs storage option?
 
 read the original defconfig. This is *only* for usbcore.ko, EHCI is
 disabled, XHCI is a module, MUSB is disabled. What will you use for
 rootfs ?

Yes, thanks for pointing. Now I see indeed this is a sensible thing
to do and probably should have been done a while ago.

Might be worth addressing/explaining this in the commit message.

- -- 
Regards,
Igor.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBAgAGBQJUmqlKAAoJEBDE8YO64EfaifUQAIdwJFKPozpzVeKJjIYKQgzy
4axv2/Z2TBybF6dlxykrjWwUIX8e24bAtG8uyhnQ/l6NPWVqNqwM/DHALyPBgjMV
EXciALKHyx6DiHoeoTEhhCCocekI/fM9o0mqQHpqzp2M+/UAnHq2Px0pK6Cfk84y
RoyrunlOKOe1rZSbcgZKoZDuMV0qYK2ULpMl3c7QL5sPIGrkWIGe2eTil3/m6jvu
qDaVzGxsBmmCFVxMKv/cXysBd88cswg8sd2ptX7skgptB7lpSKRiAT69c3MXaJyM
zsbE4AE9fiYb0/aZO3hmmWlNp6OM1hxY/8IjL92Sydys/bXxDHQj1fePr9ofsFYM
vSohR6IOopv1xwr6PIKyL+brWJ0p07qKNWA5vrG21D/U0B6H/IPcSbneQtHnMkJl
jf6GccX5gG49MSTDWryFOtErsNXRf6Q5zaZGYTpEsDMXhCKTYJgBhoFX5i3fW4wH
kV/doXku38SAmwRBU0oLjNs07y1I0ijgBHLTtx3XZSd7fkM3CAWsToDapz7df+bx
FAi0+DZk3DVNhJoAeyaRauZQlLU//3McM2zFX8/11K9BP76n6OTanYnjVoJq0SNo
JIjEjmFMFtIF7Zke4JpUCkYlpcW17gQLfUCrcIW1WUq6i0TAGyILmDvZPgMp6+yk
bqMgzSs8ZRXyjqm6Uj7O
=UcBr
-END PGP SIGNATURE-
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] thermal: ti-soc-thermal: ti-bandgap.c: Remove unused function

2014-12-24 Thread Nishanth Menon
On 12/21/2014 11:43 AM, Rickard Strandqvist wrote:
 Remove the function ti_bandgap_write_thot() that is not used anywhere.
 
 This was partially found by using a static code analysis program called 
 cppcheck.
 
 Signed-off-by: Rickard Strandqvist rickard_strandqv...@spectrumdigital.se
 ---
  drivers/thermal/ti-soc-thermal/ti-bandgap.c |   13 -
  drivers/thermal/ti-soc-thermal/ti-bandgap.h |1 -
  2 files changed, 14 deletions(-)
 
 diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c 
 b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
 index 634b6ce..cbb6a5f 100644
 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
 +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
 @@ -611,19 +611,6 @@ int ti_bandgap_read_thot(struct ti_bandgap *bgp, int id, 
 int *thot)
  }
  
  /**
 - * ti_bandgap_write_thot() - sets sensor current thot
 - * @bgp: pointer to bandgap instance
 - * @id: sensor id
 - * @val: desired thot value
 - *
 - * Return: 0 on success or the proper error code
 - */
 -int ti_bandgap_write_thot(struct ti_bandgap *bgp, int id, int val)
 -{
 - return _ti_bandgap_write_threshold(bgp, id, val, true);
 -}
 -
 -/**
   * ti_bandgap_read_tcold() - reads sensor current tcold
   * @bgp: pointer to bandgap instance
   * @id: sensor id
 diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.h 
 b/drivers/thermal/ti-soc-thermal/ti-bandgap.h
 index b3adf72..976afc0 100644
 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.h
 +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.h
 @@ -371,7 +371,6 @@ struct ti_bandgap_data {
  };
  
  int ti_bandgap_read_thot(struct ti_bandgap *bgp, int id, int *thot);
 -int ti_bandgap_write_thot(struct ti_bandgap *bgp, int id, int val);
  int ti_bandgap_read_tcold(struct ti_bandgap *bgp, int id, int *tcold);
  int ti_bandgap_write_tcold(struct ti_bandgap *bgp, int id, int val);
  int ti_bandgap_read_update_interval(struct ti_bandgap *bgp, int id,
 

Not sure if removing support for programming of hot threshold is a
good idea. how about ti_bandgap_write_tcold then?


-- 
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] arm: omap: reduce zImage size on omap2plus_defconfig

2014-12-24 Thread Felipe Balbi
Hi,

On Wed, Dec 24, 2014 at 01:53:46PM +0200, Igor Grinberg wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 12/23/14 18:19, Felipe Balbi wrote:
  On Tue, Dec 23, 2014 at 09:30:45AM +0200, Igor Grinberg wrote:
  Hi Felipe,
 
  On 12/22/14 20:05, Felipe Balbi wrote:
 
  [...]
 
   CONFIG_SCSI_SCAN_ASYNC=y
  -CONFIG_ATA=y
  -CONFIG_SATA_AHCI_PLATFORM=y
  -CONFIG_MD=y
  +CONFIG_ATA=m
  +CONFIG_SATA_AHCI_PLATFORM=m
 
  Isn't this needed for the rootfs on SATA devices?
  
  there's no known boards with rootfs on SATA. Until then, we can reduce
  the size.
 
 What makes you say so?
 The decision for rootfs on SATA is taken dynamically.
 OMAP5 boards (specifically cm-t54) can have rootfs on SATA...

I'll leave the decision to Tony. Even though they _can_, they really
don't and IIRC, OMAP5's SATA has so many silicon errata that it'd be
annoying to find that special device which works (e.g it can't negotiate
lower speeds with SATA III devices and it won't support SATA I).

As of today, we don't know of anybody really shipping anything with
rootfs on SATA and distros would rather ship initiramfs than a giant
zImage anyway.

Tony, your call.

  -CONFIG_USB=y
  +CONFIG_HID_GENERIC=m
  +CONFIG_USB_HIDDEV=y
  +CONFIG_USB_KBD=m
  +CONFIG_USB_MOUSE=m
  +CONFIG_USB=m
 
  So, you don't consider USB a valid rootfs storage option?
  
  read the original defconfig. This is *only* for usbcore.ko, EHCI is
  disabled, XHCI is a module, MUSB is disabled. What will you use for
  rootfs ?
 
 Yes, thanks for pointing. Now I see indeed this is a sensible thing
 to do and probably should have been done a while ago.
 
 Might be worth addressing/explaining this in the commit message.

right, I'll look at it after holiday season.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] arm: omap: reduce zImage size on omap2plus_defconfig

2014-12-24 Thread Tony Lindgren
* Felipe Balbi ba...@ti.com [141224 07:52]:
 Hi,
 
 On Wed, Dec 24, 2014 at 01:53:46PM +0200, Igor Grinberg wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
  
  On 12/23/14 18:19, Felipe Balbi wrote:
   On Tue, Dec 23, 2014 at 09:30:45AM +0200, Igor Grinberg wrote:
   Hi Felipe,
  
   On 12/22/14 20:05, Felipe Balbi wrote:
  
   [...]
  
CONFIG_SCSI_SCAN_ASYNC=y
   -CONFIG_ATA=y
   -CONFIG_SATA_AHCI_PLATFORM=y
   -CONFIG_MD=y
   +CONFIG_ATA=m
   +CONFIG_SATA_AHCI_PLATFORM=m
  
   Isn't this needed for the rootfs on SATA devices?
   
   there's no known boards with rootfs on SATA. Until then, we can reduce
   the size.
  
  What makes you say so?
  The decision for rootfs on SATA is taken dynamically.
  OMAP5 boards (specifically cm-t54) can have rootfs on SATA...
 
 I'll leave the decision to Tony. Even though they _can_, they really
 don't and IIRC, OMAP5's SATA has so many silicon errata that it'd be
 annoying to find that special device which works (e.g it can't negotiate
 lower speeds with SATA III devices and it won't support SATA I).
 
 As of today, we don't know of anybody really shipping anything with
 rootfs on SATA and distros would rather ship initiramfs than a giant
 zImage anyway.
 
 Tony, your call.

I think we should move omap2plus_defconfig to be mostly modular and
usable for distros as a base. Most distros prefer to build almost
everything as loadable modules. And my preference is that we should
only keep the minimum rootfs for devices and serial support as
built-in and rely on initramfs for most drivers. And slowly move
also the remaining built-in drivers to be loadable modules.

The reasons for having drivers as loadable modules are many. It
allows distros to use the same kernel for all the devices without
bloating the kernel. It makes developing drivers easier as just the
module needs to be reloaded. And loadable modules protect us from
cross-framework spaghetti calls in the kernel as the interfaces are 
clearly defined.

Are there people really using SATA as rootfs right now on omaps?

If it's only something that will be more widely used in the future,
then I suggest we make it into a loadable module, and presume
initramfs and loadable module also for any new devices. The same
way x86 has been doing with distros for years.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] mmc: omap_hsmmc: use mmc_of_parse to parse common mmc configuration.

2014-12-24 Thread NeilBrown
This ensures that all standard options are available to hsmmc,
In particular, I need cap-power-off-card.

Signed-off-by: NeilBrown ne...@suse.de
---
 drivers/mmc/host/omap_hsmmc.c |   33 -
 1 file changed, 8 insertions(+), 25 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 149cc252fcbd..36cd73342afc 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1931,13 +1931,6 @@ static struct omap_hsmmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
 {
struct omap_hsmmc_platform_data *pdata;
struct device_node *np = dev-of_node;
-   u32 bus_width, max_freq;
-   int cd_gpio, wp_gpio;
-
-   cd_gpio = of_get_named_gpio(np, cd-gpios, 0);
-   wp_gpio = of_get_named_gpio(np, wp-gpios, 0);
-   if (cd_gpio == -EPROBE_DEFER || wp_gpio == -EPROBE_DEFER)
-   return ERR_PTR(-EPROBE_DEFER);
 
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
@@ -1946,34 +1939,20 @@ static struct omap_hsmmc_platform_data 
*of_get_hsmmc_pdata(struct device *dev)
if (of_find_property(np, ti,dual-volt, NULL))
pdata-controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;
 
-   pdata-switch_pin = cd_gpio;
-   pdata-gpio_wp = wp_gpio;
+   pdata-switch_pin = -EINVAL;
+   pdata-gpio_wp = -EINVAL;
 
if (of_find_property(np, ti,non-removable, NULL)) {
pdata-nonremovable = true;
pdata-no_regulator_off_init = true;
}
-   of_property_read_u32(np, bus-width, bus_width);
-   if (bus_width == 4)
-   pdata-caps |= MMC_CAP_4_BIT_DATA;
-   else if (bus_width == 8)
-   pdata-caps |= MMC_CAP_8_BIT_DATA;
 
if (of_find_property(np, ti,needs-special-reset, NULL))
pdata-features |= HSMMC_HAS_UPDATED_RESET;
 
-   if (!of_property_read_u32(np, max-frequency, max_freq))
-   pdata-max_freq = max_freq;
-
if (of_find_property(np, ti,needs-special-hs-handling, NULL))
pdata-features |= HSMMC_HAS_HSPE_SUPPORT;
 
-   if (of_find_property(np, keep-power-in-suspend, NULL))
-   pdata-pm_caps |= MMC_PM_KEEP_POWER;
-
-   if (of_find_property(np, enable-sdio-wakeup, NULL))
-   pdata-pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
-
return pdata;
 }
 #else
@@ -2031,6 +2010,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
goto err;
}
 
+   ret = mmc_of_parse(mmc);
+   if (ret)
+   goto err1;
+
host= mmc_priv(mmc);
host-mmc   = mmc;
host-pdata = pdata;
@@ -2059,7 +2042,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
if (pdata-max_freq  0)
mmc-f_max = pdata-max_freq;
-   else
+   else if (mmc-f_max == 0)
mmc-f_max = OMAP_MMC_MAX_CLOCK;
 
spin_lock_init(host-irq_lock);
@@ -2113,7 +2096,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
if (mmc_pdata(host)-nonremovable)
mmc-caps |= MMC_CAP_NONREMOVABLE;
 
-   mmc-pm_caps = mmc_pdata(host)-pm_caps;
+   mmc-pm_caps |= mmc_pdata(host)-pm_caps;
 
omap_hsmmc_conf_bus_power(host);
 


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] Convert omap_hsmmc to use common devicetree parsing code.

2014-12-24 Thread NeilBrown
This is a resend against latest
  git://git.linaro.org/people/ulf.hansson/mmc next

with requested changes.

My goal is to get omap_hsmmc to use the common code for parsing of,
particularly so that I can set cap-power-off-card, which omap_hsmmc
doesn't explicitly report.

Thanks,
NeilBrown



---

NeilBrown (3):
  mmc: core: Allow host driver to provide isr for card-detect interrupts.
  mmc: omap_hsmmc: use slot-gpio library for gpio support.
  mmc: omap_hsmmc: use mmc_of_parse to parse common mmc configuration.


 drivers/mmc/core/slot-gpio.c  |   20 
 drivers/mmc/host/omap_hsmmc.c |  100 +
 include/linux/mmc/slot-gpio.h |2 +
 3 files changed, 43 insertions(+), 79 deletions(-)

--
Signature

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] mmc: omap_hsmmc: use slot-gpio library for gpio support.

2014-12-24 Thread NeilBrown
Using the common code removes some code duplication, and
makes it easier to switch to using mmc_of_parse() which
will remove more duplication.

This uses the new mmc_gpio_set_cd_isr to provide a non-standard
interrupt service routine for card-detect interrupts.

Signed-off-by: NeilBrown ne...@suse.de
---
 drivers/mmc/host/omap_hsmmc.c |   67 +
 1 file changed, 14 insertions(+), 53 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 537cba8f1de1..149cc252fcbd 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -36,6 +36,7 @@
 #include linux/mmc/host.h
 #include linux/mmc/core.h
 #include linux/mmc/mmc.h
+#include linux/mmc/slot-gpio.h
 #include linux/io.h
 #include linux/irq.h
 #include linux/gpio.h
@@ -251,28 +252,22 @@ static void omap_hsmmc_start_dma_transfer(struct 
omap_hsmmc_host *host);
 static int omap_hsmmc_card_detect(struct device *dev)
 {
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
-   struct omap_hsmmc_platform_data *mmc = host-pdata;
 
-   /* NOTE: assumes card detect signal is active-low */
-   return !gpio_get_value_cansleep(mmc-switch_pin);
+   return mmc_gpio_get_cd(host-mmc);
 }
 
 static int omap_hsmmc_get_wp(struct device *dev)
 {
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
-   struct omap_hsmmc_platform_data *mmc = host-pdata;
 
-   /* NOTE: assumes write protect signal is active-high */
-   return gpio_get_value_cansleep(mmc-gpio_wp);
+   return mmc_gpio_get_ro(host-mmc);
 }
 
 static int omap_hsmmc_get_cover_state(struct device *dev)
 {
struct omap_hsmmc_host *host = dev_get_drvdata(dev);
-   struct omap_hsmmc_platform_data *mmc = host-pdata;
 
-   /* NOTE: assumes card detect signal is active-low */
-   return !gpio_get_value_cansleep(mmc-switch_pin);
+   return mmc_gpio_get_cd(host-mmc);
 }
 
 #ifdef CONFIG_REGULATOR
@@ -439,7 +434,10 @@ static inline int omap_hsmmc_have_reg(void)
 
 #endif
 
-static int omap_hsmmc_gpio_init(struct omap_hsmmc_host *host,
+static irqreturn_t omap_hsmmc_detect(int irq, void *dev_id);
+
+static int omap_hsmmc_gpio_init(struct mmc_host *mmc,
+   struct omap_hsmmc_host *host,
struct omap_hsmmc_platform_data *pdata)
 {
int ret;
@@ -452,46 +450,26 @@ static int omap_hsmmc_gpio_init(struct omap_hsmmc_host 
*host,
host-card_detect = omap_hsmmc_card_detect;
host-card_detect_irq =
gpio_to_irq(pdata-switch_pin);
-   ret = gpio_request(pdata-switch_pin, mmc_cd);
+   ret = mmc_gpio_set_cd_isr(mmc, omap_hsmmc_detect);
if (ret)
return ret;
-   ret = gpio_direction_input(pdata-switch_pin);
+   ret = mmc_gpio_request_cd(mmc, pdata-switch_pin, 0);
if (ret)
-   goto err_free_sp;
+   return ret;
} else {
pdata-switch_pin = -EINVAL;
}
 
if (gpio_is_valid(pdata-gpio_wp)) {
host-get_ro = omap_hsmmc_get_wp;
-   ret = gpio_request(pdata-gpio_wp, mmc_wp);
-   if (ret)
-   goto err_free_cd;
-   ret = gpio_direction_input(pdata-gpio_wp);
+   ret = mmc_gpio_request_ro(mmc, pdata-gpio_wp);
if (ret)
-   goto err_free_wp;
+   return ret;
} else {
pdata-gpio_wp = -EINVAL;
}
 
return 0;
-
-err_free_wp:
-   gpio_free(pdata-gpio_wp);
-err_free_cd:
-   if (gpio_is_valid(pdata-switch_pin))
-err_free_sp:
-   gpio_free(pdata-switch_pin);
-   return ret;
-}
-
-static void omap_hsmmc_gpio_free(struct omap_hsmmc_host *host,
-struct omap_hsmmc_platform_data *pdata)
-{
-   if (gpio_is_valid(pdata-gpio_wp))
-   gpio_free(pdata-gpio_wp);
-   if (gpio_is_valid(pdata-switch_pin))
-   gpio_free(pdata-switch_pin);
 }
 
 /*
@@ -2066,7 +2044,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
host-next_data.cookie = 1;
host-pbias_enabled = 0;
 
-   ret = omap_hsmmc_gpio_init(host, pdata);
+   ret = omap_hsmmc_gpio_init(mmc, host, pdata);
if (ret)
goto err_gpio;
 
@@ -2197,20 +2175,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 
mmc-ocr_avail = mmc_pdata(host)-ocr_mask;
 
-   /* Request IRQ for card detect */
-   if (host-card_detect_irq) {
-   ret = devm_request_threaded_irq(pdev-dev,
-   host-card_detect_irq,
-   NULL, omap_hsmmc_detect,
-  IRQF_TRIGGER_RISING | 
IRQF_TRIGGER_FALLING | 

[PATCH 1/3] mmc: core: Allow host driver to provide isr for card-detect interrupts.

2014-12-24 Thread NeilBrown
One of the reasons omap_hsmmc doesn't use the slot-gpio library
is that it has some non-standard functionality in the card-detect
interrupt service routine.

To make it possible for omap_hsmmc (and maybe others) to be converted
to use slot-gpio, add 'mmc_gpio_set_cd_isr' which provides an
alternate isr to be registered by the slot-gpio code.

Signed-off-by: NeilBrown ne...@suse.de
---
 drivers/mmc/core/slot-gpio.c  |   20 +++-
 include/linux/mmc/slot-gpio.h |2 ++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index 1a3edbd47719..1826b25a2a40 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -25,6 +25,7 @@ struct mmc_gpio {
struct gpio_desc *cd_gpio;
bool override_ro_active_level;
bool override_cd_active_level;
+   irqreturn_t (*cd_gpio_isr)(int irq, void *dev_id);
char *ro_label;
char cd_label[0];
 };
@@ -136,8 +137,10 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
irq = -EINVAL;
 
if (irq = 0) {
+   if (!ctx-cd_gpio_isr)
+   ctx-cd_gpio_isr = mmc_gpio_cd_irqt;
ret = devm_request_threaded_irq(host-parent, irq,
-   NULL, mmc_gpio_cd_irqt,
+   NULL, ctx-cd_gpio_isr,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | 
IRQF_ONESHOT,
ctx-cd_label, host);
if (ret  0)
@@ -151,6 +154,21 @@ void mmc_gpiod_request_cd_irq(struct mmc_host *host)
 }
 EXPORT_SYMBOL(mmc_gpiod_request_cd_irq);
 
+/* Register an alternate interrupt service routine for
+ * the card-detect GPIO.
+ */
+int mmc_gpio_set_cd_isr(struct mmc_host *host,
+   irqreturn_t (*isr)(int irq, void *dev_id))
+{
+   struct mmc_gpio *ctx;
+
+   ctx = host-slot.handler_priv;
+   if (ctx-cd_gpio_isr)
+   return -EBUSY;
+   ctx-cd_gpio_isr = isr;
+   return 0;
+}
+
 /**
  * mmc_gpio_request_cd - request a gpio for card-detection
  * @host: mmc host
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index 4a36d6954631..4faf41c9a77a 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -26,6 +26,8 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char 
*con_id,
 int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
 unsigned int idx, bool override_active_level,
 unsigned int debounce, bool *gpio_invert);
+int mmc_gpio_set_cd_isr(struct mmc_host *host,
+   irqreturn_t (*isr)(int irq, void *dev_id));
 void mmc_gpiod_request_cd_irq(struct mmc_host *host);
 
 #endif


--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2] media: i2c/adp1653: devicetree support for adp1653

2014-12-24 Thread Pavel Machek

We are moving to device tree support on OMAP3, but that currently
breaks ADP1653 driver. This adds device tree support, plus required
documentation.

Signed-off-by: Pavel Machek pa...@ucw.cz

---

Changed -microsec to -us, as requested by devicetree people.

Fixed checkpatch issues.

diff --git a/Documentation/devicetree/bindings/leds/common.txt 
b/Documentation/devicetree/bindings/leds/common.txt
index 2d88816..2c6c7c5 100644
--- a/Documentation/devicetree/bindings/leds/common.txt
+++ b/Documentation/devicetree/bindings/leds/common.txt
@@ -14,6 +14,15 @@ Optional properties for child nodes:
  ide-disk - LED indicates disk activity
  timer - LED flashes at a fixed, configurable rate
 
+- max-microamp : maximum intensity in microamperes of the LED
+(torch LED for flash devices)
+- flash-max-microamp : maximum intensity in microamperes of the
+   flash LED; it is mandatory if the LED should
+  support the flash mode
+- flash-timeout-microsec : timeout in microseconds after which the flash
+   LED is turned off
+
+
 Examples:
 
 system-status {
@@ -21,3 +30,10 @@ system-status {
linux,default-trigger = heartbeat;
...
 };
+
+camera-flash {
+   label = Flash;
+   max-microamp = 5;
+   flash-max-microamp = 32;
+   flash-timeout-microsec = 50;
+}
diff --git a/Documentation/devicetree/bindings/media/i2c/adp1653.txt 
b/Documentation/devicetree/bindings/media/i2c/adp1653.txt
new file mode 100644
index 000..3c7065f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adp1653.txt
@@ -0,0 +1,38 @@
+* Analog Devices ADP1653 flash LED driver
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+- adi,adp1653
+
+  - reg: I2C slave address
+
+  - gpios: References to the GPIO that controls the power for the chip.
+
+There are two led outputs available - flash and indicator. One led is
+represented by one child node, nodes need to be named flash and indicator.
+
+Required properties of the LED child node:
+- max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+
+Required properties of the flash LED child node:
+
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+- flash-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+
+adp1653: led-controller@30 {
+compatible = adi,adp1653;
+   reg = 0x30;
+gpios = gpio3 24 GPIO_ACTIVE_HIGH; /* 88 */
+
+   flash {
+flash-timeout-us = 50;
+flash-max-microamp = 32;
+max-microamp = 5;
+   };
+indicator {
+max-microamp = 17500;
+   };
+};
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index bc82a12..d04e7cc 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -553,6 +558,22 @@
 
ti,usb-charger-detection = isp1704;
};
+
+   adp1653: led-controller@30 {
+   compatible = adi,adp1653;
+   reg = 0x30;
+   gpios = gpio3 24 GPIO_ACTIVE_HIGH; /* 88 */
+
+   flash {
+   flash-timeout-us = 50;
+   flash-max-microamp = 32;
+   max-microamp = 5;
+   };
+
+   indicator {
+   max-microamp = 17500;
+   };
+   };
 };
 
 i2c3 {
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index 873fe19..78341d0 100644
--- a/drivers/media/i2c/adp1653.c
+++ b/drivers/media/i2c/adp1653.c
@@ -8,6 +8,7 @@
  * Contributors:
  * Sakari Ailus sakari.ai...@iki.fi
  * Tuukka Toivonen tuukka...@gmail.com
+ *  Pavel Machek pa...@ucw.cz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -34,9 +35,12 @@
 #include linux/module.h
 #include linux/i2c.h
 #include linux/slab.h
+#include linux/of_gpio.h
 #include media/adp1653.h
 #include media/v4l2-device.h
 
+#include linux/gpio.h
+
 #define TIMEOUT_MAX82
 #define TIMEOUT_STEP   54600
 #define TIMEOUT_MIN(TIMEOUT_MAX - ADP1653_REG_CONFIG_TMR_SET_MAX \
@@ -306,9 +318,18 @@ adp1653_init_device(struct adp1653_flash *flash)
 static int
 __adp1653_set_power(struct adp1653_flash *flash, int on)
 {
-   int ret;
+   int ret = 0;
+
+   if (flash-platform_data-power)
+   ret = flash-platform_data-power(flash-subdev, on);
+   else {
+   gpio_set_value(flash-platform_data-power_gpio, on);
+   if (on) {
+   /* Some delay is apparently required. */
+   udelay(20);
+   }
+   }
 
-   ret = 

Re: [PATCH] media: i2c/adp1653: devicetree support for adp1653

2014-12-24 Thread Pavel Machek
On Tue 2014-12-23 21:49:04, Pavel Machek wrote:
 On Tue 2014-12-23 15:23:25, Mauro Carvalho Chehab wrote:
  Em Wed, 3 Dec 2014 22:46:41 +0100
  Pavel Machek pa...@ucw.cz escreveu:
  
   
   We are moving to device tree support on OMAP3, but that currently
   breaks ADP1653 driver. This adds device tree support, plus required
   documentation.
   
   Signed-off-by: Pavel Machek pa...@ucw.cz
  
  Please be sure to check your patch with checkpatch. There are several
  issues on it:

Ok, you should have fixed version in your inbox.

Happy holidays!
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


v3.19-rc1 regression(?) on N900

2014-12-24 Thread Nishanth Menon
based on automated testing with u-boot as a chained bootloader..

v3.18: boots fine:
https://github.com/nmenon/kernel-test-logs/blob/v3.18/omap2plus_defconfig/n900.txt

v3.19-rc1: hung
https://github.com/nmenon/kernel-test-logs/blob/v3.19-rc1/omap2plus_defconfig/n900.txt

in the interim, my farm had a bit of breakdown around the time of n900
breakdown..

as per my last functional linux-next logs:
https://github.com/nmenon/kernel-test-logs/blob/next-20141204/omap2plus_defconfig/n900.txt
- hung.
https://github.com/nmenon/kernel-test-logs/blob/next-20141112/omap2plus_defconfig/n900.txt
- working.

DEBUG_LL, CONFIG_DEBUG_OMAP3UART3=y and early_printk did not yield
information either

Note: I am using the combined uImage+dtb image.[2]

I think this might just be my setup..(i use chained loader -
NOLO-u-boot-serial download-kernel) but anyways.. Since Pali
thought others might be interested in sharing experience...

[1]   http://slexy.org/raw/s2osxhhwbR
[2]
https://github.com/nmenon/linux-2.6-playground/commit/177f5f71b3f21ea484ee4b09a2e0c015de522417

-- 
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html