diff options
author | Zhang Jiejing <jiejing.zhang@freescale.com> | 2010-12-23 21:08:07 +0800 |
---|---|---|
committer | Zhang Jiejing <jiejing.zhang@freescale.com> | 2011-03-18 12:13:57 -0500 |
commit | 3b6cefe0c1c343371428308c7a8a07c20a7ded14 (patch) | |
tree | bb9ef21c1dda759bce21218b24127708aa08cebc /sound | |
parent | 06487ceb80eb9bb3db4468c57999dc29da062036 (diff) |
ENGR00137340 Add headphone detection in imx5x.
Report uevent when headphone detect part is changed.
Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/imx/imx-3stack-sgtl5000.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sound/soc/imx/imx-3stack-sgtl5000.c b/sound/soc/imx/imx-3stack-sgtl5000.c index cccc0bda6150..3f13a2598262 100644 --- a/sound/soc/imx/imx-3stack-sgtl5000.c +++ b/sound/soc/imx/imx-3stack-sgtl5000.c @@ -1,7 +1,7 @@ /* * imx-3stack-sgtl5000.c -- i.MX 3Stack Driver for Freescale SGTL5000 Codec * - * Copyright (C) 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2008-2011 Freescale Semiconductor, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -301,9 +301,23 @@ static void headphone_detect_handler(struct work_struct *work) struct platform_device *pdev = priv->pdev; struct mxc_audio_platform_data *plat = pdev->dev.platform_data; int hp_status; + char *envp[3]; + char *buf; sysfs_notify(&pdev->dev.kobj, NULL, "headphone"); hp_status = plat->hp_status(); + + /* setup a message for userspace headphone in */ + buf = kmalloc(32, GFP_ATOMIC); + if (!buf) + return -ENOMEM; + envp[0] = "NAME=headphone"; + snprintf(buf, 32, "STATE=%d", hp_status); + envp[1] = buf; + envp[2] = NULL; + kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp); + kfree(buf); + if (hp_status) set_irq_type(plat->hp_irq, IRQ_TYPE_EDGE_FALLING); else |