[PATCH] drivers: staging: GPS protocol driver for wl128x

Previous thread: [PATCH][GIT PULL] tracing: Convert nop macros to static inlines by Steven Rostedt on Tuesday, May 4, 2010 - 9:17 am. (2 messages)

Next thread: patch by Kristoffer Ericson on Tuesday, May 4, 2010 - 9:48 am. (1 message)
From: Pavan Savoy
Date: Tuesday, May 4, 2010 - 9:25 am

Greg, Alan,

Just to complete the circle on N_TI_WL, find below the GPS driver which makes use of the shared transport line discipline.

This driver provides a TTY line character device to application/middle-ware running on host, as if the device is directly connected over UART to a GPS chip.

Almost all actions that can be done on a /dev/ttySx can be done on this /dev/tigps device.

So with Bluetooth and GPS drivers as the consumers of this N_TI_WL line discipline, how can I tweak the line discipline driver for proper submission [out of staging] ?
(will send out the patch for Kconfig/Makefile once you guys have a look at this..)

From dc6c64e732bb662471a1f9b95f8f68ab657e30e6 Mon Sep 17 00:00:00 2001
From: Pavan Savoy <pavan_savoy@ti.com>
Date: Mon, 3 May 2010 17:41:23 -0600
Subject: [PATCH] drivers: staging: GPS protocol driver for wl128x

Texas Instrument's wl128x connectivity combo chip
has BT, FM and GPS interfaced to host/apps processor
over a single UART.
This is the driver for the GPS protocol which makes use of
the N_TI_WL TTY line discipline.

Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
Signed-off-by: Nagarjuna Kristam <x0043706@ti.com>
Signed-off-by: Sunil Pillai <sunil_pillai@ti.com>
---
 drivers/staging/ti-st/gps_drv.c |  732 +++++++++++++++++++++++++++++++++++++++
 drivers/staging/ti-st/gps_drv.h |   91 +++++
 2 files changed, 823 insertions(+), 0 deletions(-)
 create mode 100644 drivers/staging/ti-st/gps_drv.c
 create mode 100644 drivers/staging/ti-st/gps_drv.h

diff --git a/drivers/staging/ti-st/gps_drv.c b/drivers/staging/ti-st/gps_drv.c
new file mode 100644
index 0000000..cbc0dac
--- /dev/null
+++ b/drivers/staging/ti-st/gps_drv.c
@@ -0,0 +1,732 @@
+/*
+ *   GPS Char Driver for Texas Instrument's Connectivity Chip.
+ *   Copyright (C) 2009 Texas Instruments
+ *
+ *   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 ...
From: Alan Cox
Date: Wednesday, May 5, 2010 - 4:11 am

On Tue, 4 May 2010 21:55:43 +0530 (IST)


Hardly true. A tty driver has a very precisely defined set of behaviours
and a lot of ioctls and interfaces your driver doesn't. Our gps
interfaces are only tty drivers because historically they were plugged
into serial ports so I'm not sure the 'not a tty' bit actually matters.

Codewise its the same as all the rest - only one instance possible and
poking around in globals with no visible or documented locking.

--

From: Savoy, Pavan
Date: Wednesday, May 5, 2010 - 9:04 am

Alan,

 
----------------
Thanks & Regards,



Yes, and this is the reason, I posted this patch.
BT and GPS had to communicate over a single UART, and this is the reason the N_TI_WL line discipline exists.
With this sort of architecture, how can I accommodate multi-device support? To avoid this single device limits?

Also, what is that you are exactly looking for regarding locking.
Please suggest.

Thanks.

--

From: Savoy, Pavan
Date: Thursday, May 6, 2010 - 1:30 pm

To support this multiple device thingy and avoid the single device limit, I plan to do something like this,

The ST driver would be platform_device - as it is already. ST's probe would do the ldisc registration, and also do the dev_set_drvdata of all the internal data (Tx queues, locks, list of protocols) on this device.

Apart from this the BT, FM and GPS would also further be platform devices, and then,
In the dev.platform_data of each of these BT, FM and GPS devices, I will enter the "parent ST device", these protocols want to attach themselves to.

And in probe of the driver for each of these BT, FM and GPS devices, I will do the same "st_register" where in now I can access the ST related data by retrieving the internal using the parent device.

Examples:
Here are the 2 ST platform devices,
struct platform_device st_device_0 = {
        .name = "ST_DEV_0",
        .id = -1,
        .dev.platform_data = &array,
        .dev.release = any_device_release,
};
struct platform_device st_device_1 = {
        .name = "ST_DEV_1",
        .id = -1,
        .dev.platform_data = &array,
        .dev.release = any_device_release,
};

BT attaching itself to ST_DEV_0,
static struct protocol_platform_data bt_data = {
        .parent_dev = &st_device_0,
        .name = "BT",
};

static struct platform_device bt_device = {
        .name = "BT",
        .id = -1,
        .dev.platform_data = &bt_data,
        .dev.release = bt_device_release,
};

And FM attaching itself to - ST_DEV_1,
static struct protocol_platform_data fm_data = {
        .parent_dev = &st_device_1,
        .name = "FM",
};
static struct platform_device fm_device = {
        .name = "FM",
        .id = -1,
        .dev.platform_data = &fm_data,
        .dev.release = fm_device_release,
};

My "ST_REGISTER" would now look like,
int st_register(struct protocol_platform_data *data)
{
        struct st_data_s *st_data;
        struct platform_device *parent = data->parent_dev;

        st_data = ...
Previous thread: [PATCH][GIT PULL] tracing: Convert nop macros to static inlines by Steven Rostedt on Tuesday, May 4, 2010 - 9:17 am. (2 messages)

Next thread: patch by Kristoffer Ericson on Tuesday, May 4, 2010 - 9:48 am. (1 message)