From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Pavan Savoy <pavan_savoy@ti.com>, Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 27/50] drivers:misc: ti-st: remove multiple gpio handling
Date: Wed, 16 Mar 2011 14:11:05 -0700 [thread overview]
Message-ID: <1300309888-5028-27-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <1300309888-5028-1-git-send-email-gregkh@suse.de>
From: Pavan Savoy <pavan_savoy@ti.com>
TI shared transport driver previously intended to expose rfkill
entries for each of the protocol gpio that the chip would have.
However now in case such gpios exist, which requires to be enabled
for a specific protocol, the responsibility lay on protocol driver.
This patch removes the request/free of multiple gpios, rfkill struct
references and also removes the chip_toggle function.
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/misc/ti-st/st_core.c | 11 ----
drivers/misc/ti-st/st_kim.c | 117 +++++++++---------------------------------
include/linux/ti_wilink_st.h | 19 +------
3 files changed, 26 insertions(+), 121 deletions(-)
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c
index f0d24d8..1847c47 100644
--- a/drivers/misc/ti-st/st_core.c
+++ b/drivers/misc/ti-st/st_core.c
@@ -515,7 +515,6 @@ long st_register(struct st_proto_s *new_proto)
if (test_bit(ST_REG_IN_PROGRESS, &st_gdata->st_state)) {
pr_info(" ST_REG_IN_PROGRESS:%d ", new_proto->chnl_id);
/* fw download in progress */
- st_kim_chip_toggle(new_proto->chnl_id, KIM_GPIO_ACTIVE);
add_channel_to_table(st_gdata, new_proto);
st_gdata->protos_registered++;
@@ -548,10 +547,6 @@ long st_register(struct st_proto_s *new_proto)
return -EINVAL;
}
- /* the chnl_id might require other gpios to be toggled
- */
- st_kim_chip_toggle(new_proto->chnl_id, KIM_GPIO_ACTIVE);
-
clear_bit(ST_REG_IN_PROGRESS, &st_gdata->st_state);
st_recv = st_int_recv;
@@ -622,12 +617,6 @@ long st_unregister(struct st_proto_s *proto)
st_gdata->protos_registered--;
remove_channel_from_table(st_gdata, proto);
-
- /* kim ignores BT in the below function
- * and handles the rest, BT is toggled
- * only in kim_start and kim_stop
- */
- st_kim_chip_toggle(proto->chnl_id, KIM_GPIO_INACTIVE);
spin_unlock_irqrestore(&st_gdata->lock, flags);
if ((st_gdata->protos_registered == ST_EMPTY) &&
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 2c096cc..9ee4c78 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -390,49 +390,6 @@ static long download_firmware(struct kim_data_s *kim_gdata)
/**********************************************************************/
/* functions called from ST core */
-/* function to toggle the GPIO
- * needs to know whether the GPIO is active high or active low
- */
-void st_kim_chip_toggle(enum proto_type type, enum kim_gpio_state state)
-{
- struct platform_device *kim_pdev;
- struct kim_data_s *kim_gdata;
- pr_info(" %s ", __func__);
-
- kim_pdev = st_get_plat_device(0);
- kim_gdata = dev_get_drvdata(&kim_pdev->dev);
-
- if (kim_gdata->gpios[type] == -1) {
- pr_info("gpio not requested for protocol %d", type);
- return;
- }
- switch (type) {
- case ST_BT:
- /*Do Nothing */
- break;
-
- case ST_FM:
- if (state == KIM_GPIO_ACTIVE)
- gpio_set_value(kim_gdata->gpios[ST_FM], GPIO_LOW);
- else
- gpio_set_value(kim_gdata->gpios[ST_FM], GPIO_HIGH);
- break;
-
- case ST_GPS:
- if (state == KIM_GPIO_ACTIVE)
- gpio_set_value(kim_gdata->gpios[ST_GPS], GPIO_HIGH);
- else
- gpio_set_value(kim_gdata->gpios[ST_GPS], GPIO_LOW);
- break;
-
- case ST_MAX_CHANNELS:
- default:
- break;
- }
-
- return;
-}
-
/* called from ST Core, when REG_IN_PROGRESS (registration in progress)
* can be because of
* 1. response to read local version
@@ -482,9 +439,9 @@ long st_kim_start(void *kim_data)
do {
/* Configure BT nShutdown to HIGH state */
- gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
+ gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
mdelay(5); /* FIXME: a proper toggle */
- gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_HIGH);
+ gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
mdelay(100);
/* re-initialize the completion */
INIT_COMPLETION(kim_gdata->ldisc_installed);
@@ -552,11 +509,11 @@ long st_kim_stop(void *kim_data)
}
/* By default configure BT nShutdown to LOW state */
- gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
+ gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
mdelay(1);
- gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_HIGH);
+ gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
mdelay(1);
- gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
+ gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
return err;
}
@@ -685,10 +642,8 @@ struct dentry *kim_debugfs_dir;
static int kim_probe(struct platform_device *pdev)
{
long status;
- long proto;
struct kim_data_s *kim_gdata;
struct ti_st_plat_data *pdata = pdev->dev.platform_data;
- long *gpios = pdata->gpios;
if ((pdev->id != -1) && (pdev->id < MAX_ST_DEVICES)) {
/* multiple devices could exist */
@@ -713,40 +668,19 @@ static int kim_probe(struct platform_device *pdev)
/* refer to itself */
kim_gdata->core_data->kim_data = kim_gdata;
- for (proto = 0; proto < ST_MAX_CHANNELS; proto++) {
- kim_gdata->gpios[proto] = gpios[proto];
- pr_info(" %ld gpio to be requested", gpios[proto]);
+ /* Claim the chip enable nShutdown gpio from the system */
+ kim_gdata->nshutdown = pdata->nshutdown_gpio;
+ status = gpio_request(kim_gdata->nshutdown, "kim");
+ if (unlikely(status)) {
+ pr_err(" gpio %ld request failed ", kim_gdata->nshutdown);
+ return status;
}
- for (proto = 0; (proto < ST_MAX_CHANNELS)
- && (gpios[proto] != -1); proto++) {
- /* Claim the Bluetooth/FM/GPIO
- * nShutdown gpio from the system
- */
- status = gpio_request(gpios[proto], "kim");
- if (unlikely(status)) {
- pr_err(" gpio %ld request failed ", gpios[proto]);
- proto -= 1;
- while (proto >= 0) {
- if (gpios[proto] != -1)
- gpio_free(gpios[proto]);
- }
- return status;
- }
-
- /* Configure nShutdown GPIO as output=0 */
- status =
- gpio_direction_output(gpios[proto], 0);
- if (unlikely(status)) {
- pr_err(" unable to configure gpio %ld",
- gpios[proto]);
- proto -= 1;
- while (proto >= 0) {
- if (gpios[proto] != -1)
- gpio_free(gpios[proto]);
- }
- return status;
- }
+ /* Configure nShutdown GPIO as output=0 */
+ status = gpio_direction_output(kim_gdata->nshutdown, 0);
+ if (unlikely(status)) {
+ pr_err(" unable to configure gpio %ld", kim_gdata->nshutdown);
+ return status;
}
/* get reference of pdev for request_firmware
*/
@@ -785,23 +719,20 @@ static int kim_remove(struct platform_device *pdev)
{
/* free the GPIOs requested */
struct ti_st_plat_data *pdata = pdev->dev.platform_data;
- long *gpios = pdata->gpios;
- long proto;
struct kim_data_s *kim_gdata;
kim_gdata = dev_get_drvdata(&pdev->dev);
- for (proto = 0; (proto < ST_MAX_CHANNELS)
- && (gpios[proto] != -1); proto++) {
- /* Claim the Bluetooth/FM/GPIO
- * nShutdown gpio from the system
- */
- gpio_free(gpios[proto]);
- }
- pr_info("kim: GPIO Freed");
- debugfs_remove_recursive(kim_debugfs_dir);
+ /* Free the Bluetooth/FM/GPIO
+ * nShutdown gpio from the system
+ */
+ gpio_free(pdata->nshutdown_gpio);
+ pr_info("nshutdown GPIO Freed");
+ debugfs_remove_recursive(kim_debugfs_dir);
sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
+ pr_info("sysfs entries removed");
+
kim_gdata->kim_pdev = NULL;
st_core_exit(kim_gdata->core_data);
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 7885a77..7071ec5 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -26,15 +26,6 @@
#define TI_WILINK_ST_H
/**
- * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW
- * gpio states for their chip/core enable gpios
- */
-enum kim_gpio_state {
- KIM_GPIO_INACTIVE,
- KIM_GPIO_ACTIVE,
-};
-
-/**
* enum proto-type - The protocol on WiLink chips which share a
* common physical interface like UART.
*/
@@ -252,14 +243,11 @@ struct chip_version {
* the ldisc was properly installed.
* @resp_buffer: data buffer for the .bts fw file name.
* @fw_entry: firmware class struct to request/release the fw.
- * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores.
* @rx_state: the rx state for kim's receive func during fw download.
* @rx_count: the rx count for the kim's receive func during fw download.
* @rx_skb: all of fw data might not come at once, and hence data storage for
* whole of the fw response, only HCI_EVENTs and hence diff from ST's
* response.
- * @rfkill: rfkill data for each of the cores to be registered with rfkill.
- * @rf_protos: proto types of the data registered with rfkill sub-system.
* @core_data: ST core's data, which mainly is the tty's disc_data
* @version: chip version available via a sysfs entry.
*
@@ -270,12 +258,10 @@ struct kim_data_s {
struct completion kim_rcvd, ldisc_installed;
char resp_buffer[30];
const struct firmware *fw_entry;
- long gpios[ST_MAX_CHANNELS];
+ long nshutdown;
unsigned long rx_state;
unsigned long rx_count;
struct sk_buff *rx_skb;
- struct rfkill *rfkill[ST_MAX_CHANNELS];
- enum proto_type rf_protos[ST_MAX_CHANNELS];
struct st_data_s *core_data;
struct chip_version version;
unsigned char ldisc_install;
@@ -293,7 +279,6 @@ long st_kim_start(void *);
long st_kim_stop(void *);
void st_kim_recv(void *, const unsigned char *, long count);
-void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state);
void st_kim_complete(void *);
void kim_st_list_protocols(struct st_data_s *, void *);
@@ -426,7 +411,7 @@ struct gps_event_hdr {
/* platform data */
struct ti_st_plat_data {
- long gpios[ST_MAX_CHANNELS]; /* BT, FM and GPS */
+ long nshutdown_gpio;
unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */
unsigned char flow_cntrl; /* flow control flag */
unsigned long baud_rate;
--
1.7.4.1
next prev parent reply other threads:[~2011-03-16 21:26 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-16 20:52 [GIT PATCH] driver core patches for .39 Greg KH
2011-03-16 21:10 ` [PATCH 01/50] driver-core: document restrictions on device_rename() Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 02/50] docs/sysfs: Update directory/kobject documentation Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 03/50] docs/sysfs: show() methods should use scnprintf() Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 04/50] kobject: Add missing format attribute specifications Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 05/50] Dynamic debug: Add more flags Greg Kroah-Hartman
2011-03-17 17:56 ` Jason Baron
2011-03-17 18:02 ` Greg KH
2011-03-18 10:22 ` Ingo Molnar
2011-03-18 11:19 ` Bart Van Assche
2011-03-16 21:10 ` [PATCH 06/50] firmware_classs: change val uevent's type to bool Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 07/50] sysdev: Fixup warning message Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 08/50] debugfs: remove module_exit() Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 09/50] sysdev: Do not register with sysdev when erroring on add Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 10/50] Translate Documentation/SecurityBugs into Chinese Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 11/50] pch_phub: add new device ML7213 Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 12/50] dynamic_debug: add #include <linux/sched.h> Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 13/50] memory hotplug: Allow memory blocks to span multiple memory sections Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 14/50] memory hotplug: Update phys_index to [start|end]_section_nr Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 15/50] memory hotplug: Define memory_block_size_bytes for powerpc/pseries Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 16/50] memory hotplug: Define memory_block_size_bytes for x86_64 with CONFIG_X86_UV Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 17/50] memory hotplug: sysfs probe routine should add all memory sections Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 18/50] driver core: Replace the dangerous to_root_device macro with an inline function Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 19/50] sysfs: Capitalize description of SYSFS_DEPRECATED{_V2} options Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 20/50] Fix a mistake Chinese character in Documentation/zh_CN/SubmittingPatches Greg Kroah-Hartman
2011-03-16 21:10 ` [PATCH 21/50] drivers:misc: ti-st: register with channel IDs Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 22/50] drivers:misc: ti-st: move from rfkill to sysfs Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 23/50] drivers:misc: ti-st: fix error codes Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 24/50] drivers:misc: ti-st: set right debug levels for logs Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 25/50] drivers:misc: ti-st: firmware download optimization Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 26/50] drivers:misc: ti-st: fix hci-ll on wake_ind collision Greg Kroah-Hartman
2011-03-16 21:11 ` Greg Kroah-Hartman [this message]
2011-03-16 21:11 ` [PATCH 28/50] kobject.h: fix build when CONFIG_HOTPLUG is disabled Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 29/50] debugfs: Fix filesystem reference counting on debugfs_remove() failure Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 30/50] Translat Documentation/SubmittingChecklist into Chinese Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 31/50] Translate linux-2.6/Documentation/magic-number.txt " Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 32/50] Driver core: convert platform_{get,set}_drvdata to static inline functions Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 33/50] firmware: Add DMI entry types to the headers Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 34/50] firmware: Basic dmi-sysfs support Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 35/50] firmware: Break out system_event_log in dmi-sysfs Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 36/50] firmware: Expose DMI type 15 System Event Log Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 37/50] firmware: Add documentation for /sys/firmware/dmi Greg Kroah-Hartman
2011-03-18 20:53 ` Valdis.Kletnieks
2011-03-18 23:50 ` [PATCH] firmware: Fix grammar in sysfs-firmware-dmi doc Mike Waychison
2011-03-16 21:11 ` [PATCH 38/50] firmware: Fix unaligned memory accesses in dmi-sysfs Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 39/50] Fix spelling mistakes in Documentation/zh_CN/SubmittingPatches Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 40/50] UIO: add PRUSS UIO driver support Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 41/50] kref: Fix typo in kref documentation Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 42/50] drivers:misc: ti-st: fix debugging code Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 43/50] efivars: move efivars globals into struct efivars Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 44/50] efivars: Make efivars bin_attributes dynamic Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 45/50] efivars: parameterize efivars Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 46/50] efivars: Split out variable registration Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 47/50] efivars: Parameterize operations Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 48/50] efivars: Expose efivars functionality to external drivers Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 49/50] efivars: Add Documentation Greg Kroah-Hartman
2011-03-16 21:11 ` [PATCH 50/50] printk: do not mangle valid userspace syslog prefixes Greg Kroah-Hartman
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=1300309888-5028-27-git-send-email-gregkh@suse.de \
--to=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pavan_savoy@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).