On Wed, Mar 18, 2009 at 7:58 PM, Misael Lopez <[email protected]> wrote:
> Hi Greg,
>
> Below are the my changes in kernel side. As mentioned in previous
> mail, I'm using Switch GPIO driver (which uses Switch Class driver) to
> generate the headset uevent. In the patch, it's also included the
> board file (for OMAP 3430SDP board) although it's not part of standard
> android kernel it may be useful for reference.

Do you have a pointer to those drivers?

I ask as I'm trying to get all of these various pieces merged upstream
properly, and if there are drivers that are out-of-tree, I'd really like
to know about them.

> diff --git a/arch/arm/mach-omap2/board-3430sdp.c
> b/arch/arm/mach-omap2/board-3430sdp.c
> index 0000d3b..701c861 100644
> --- a/arch/arm/mach-omap2/board-3430sdp.c
> +++ b/arch/arm/mach-omap2/board-3430sdp.c
> @@ -24,6 +24,7 @@
>  #include <linux/spi/ads7846.h>
>  #include <linux/i2c/twl4030.h>
>  #include <linux/mm.h>
> +#include <linux/switch.h>
>
>  #include <mach/hardware.h>
>  #include <asm/mach-types.h>
> @@ -1140,10 +1141,24 @@ static struct platform_device sdp3430_lcd_device = {
>        .id             = -1,
>  };
>
> +
> +static struct gpio_switch_platform_data headset_switch_data = {
> +       .name = "h2w",
> +       .gpio = OMAP_MAX_GPIO_LINES + 2,        /*TWL4030 GPIO_2 */
> +};
> +
> +static struct platform_device headset_switch_device = {
> +       .name             = "switch-gpio",
> +       .dev = {
> +               .platform_data    = &headset_switch_data,
> +       }
> +};
> +
>  static struct platform_device *sdp3430_devices[] __initdata = {
>        &sdp3430_smc91x_device,
>        &irda_device,
>        &sdp3430_lcd_device,
> +       &headset_switch_device,
>  };
>
>  static inline void __init sdp3430_init_smc91x(void)
> @@ -1224,6 +1239,7 @@ static struct twl4030_gpio_platform_data
> sdp3430_gpio_data = {
>        .irq_end        = TWL4030_GPIO_IRQ_END,
>  };
>
> +
>  static struct twl4030_usb_data sdp3430_usb_data = {
>        .usb_mode       = T2_USB_MODE_ULPI,
>  };
> diff --git a/drivers/switch/switch_gpio.c b/drivers/switch/switch_gpio.c
> index cfd1339..82e29a2 100644
> --- a/drivers/switch/switch_gpio.c
> +++ b/drivers/switch/switch_gpio.c
> @@ -22,6 +22,7 @@
>  #include <linux/switch.h>
>  #include <linux/workqueue.h>
>  #include <linux/gpio.h>
> +#include <linux/interrupt.h>
>
>  struct gpio_switch_data {
>        struct switch_dev sdev;
> @@ -110,7 +111,8 @@ static int gpio_switch_probe(struct platform_device *pdev)
>        }
>
>        ret = request_irq(switch_data->irq, gpio_irq_handler,
> -                         IRQF_TRIGGER_LOW, pdev->name, switch_data);
> +                         IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> +                         pdev->name, switch_data);
>        if (ret < 0)
>                goto err_request_irq;

Looks sane to me.

> In Android side, the DEVPATH value generated by the uevent doesn't
> match with the one specified in HeadsetObserver.
>
> diff --git a/services/java/com/android/server/HeadsetObserver.java
> b/services/java/com/android/server/HeadsetObserver.java
> index 2bea731..e5c7706 100644
> --- a/services/java/com/android/server/HeadsetObserver.java
> +++ b/services/java/com/android/server/HeadsetObserver.java
> @@ -32,7 +32,7 @@ import java.io.FileNotFoundException;
>  class HeadsetObserver extends UEventObserver {
>     private static final String TAG = HeadsetObserver.class.getSimpleName();
>
> -    private static final String HEADSET_UEVENT_MATCH =
> "DEVPATH=/devices/virtual/switch/h2w";
> +    private static final String HEADSET_UEVENT_MATCH =
> "DEVPATH=/class/switch/h2w";

That worries me, are you perhaps not building your kernel with
CONFIG_SYSFS_DEPRECATED disabled?  Do you not have any
"/sys/devices/virtual/" files?  You shouldn't have to make this change.

thanks,

greg k-h

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel
-~----------~----~----~----~------~----~------~--~---

Reply via email to