Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205619
b: refs/heads/master
c: e2a5328
h: refs/heads/master
i:
  205617: e155f3d
  205615: ab072b9
v: v3
  • Loading branch information
Naveen Jain authored and Greg Kroah-Hartman committed Jun 18, 2010
1 parent d05389a commit 30ba394
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b38fc2d965c3182c1855f868144a41a137e07983
refs/heads/master: e2a53282859fab0e428a243cbe9ca8d727d9d840
40 changes: 35 additions & 5 deletions trunk/drivers/staging/ti-st/st_kim.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,28 @@ static struct platform_driver kim_platform_driver = {
};

static ssize_t show_pid(struct device *dev, struct device_attribute
*attr, char *buf);
*attr, char *buf);
static ssize_t store_pid(struct device *dev, struct device_attribute
*devattr, char *buf, size_t count);
*devattr, char *buf, size_t count);
static ssize_t show_list(struct device *dev, struct device_attribute
*attr, char *buf);

*attr, char *buf);
static ssize_t show_version(struct device *dev, struct device_attribute
*attr, char *buf);
/* structures specific for sysfs entries */
static struct kobj_attribute pid_attr =
__ATTR(pid, 0644, (void *)show_pid, (void *)store_pid);

static struct kobj_attribute list_protocols =
__ATTR(protocols, 0444, (void *)show_list, NULL);

static struct kobj_attribute chip_version =
__ATTR(version, 0444, (void *)show_version, NULL);

static struct attribute *uim_attrs[] = {
&pid_attr.attr,
/* add more debug sysfs entries */
&list_protocols.attr,
&chip_version.attr,
NULL,
};

Expand Down Expand Up @@ -251,7 +256,8 @@ static long read_local_version(char *bts_scr_name)
}

version =
MAKEWORD(kim_gdata->resp_buffer[13], kim_gdata->resp_buffer[14]);
MAKEWORD(kim_gdata->resp_buffer[13],
kim_gdata->resp_buffer[14]);
chip = (version & 0x7C00) >> 10;
min_ver = (version & 0x007F);
maj_ver = (version & 0x0380) >> 7;
Expand All @@ -260,6 +266,13 @@ static long read_local_version(char *bts_scr_name)
maj_ver |= 0x0008;

sprintf(bts_scr_name, "TIInit_%d.%d.%d.bts", chip, maj_ver, min_ver);

/* to be accessed later via sysfs entry */
kim_gdata->version.full = version;
kim_gdata->version.chip = chip;
kim_gdata->version.maj_ver = maj_ver;
kim_gdata->version.min_ver = min_ver;

pr_info("%s", bts_scr_name);
return ST_SUCCESS;
}
Expand Down Expand Up @@ -516,6 +529,16 @@ long st_kim_stop(void)

/**********************************************************************/
/* functions called from subsystems */
/* called when sysfs entry is read from */

static ssize_t show_version(struct device *dev, struct device_attribute
*attr, char *buf)
{
sprintf(buf, "%04X %d.%d.%d", kim_gdata->version.full,
kim_gdata->version.chip, kim_gdata->version.maj_ver,
kim_gdata->version.min_ver);
return strlen(buf);
}

/* called when sysfs entry is written to */
static ssize_t store_pid(struct device *dev, struct device_attribute
Expand Down Expand Up @@ -656,6 +679,12 @@ static int kim_probe(struct platform_device *pdev)
}
pr_info("rfkill entry created for %ld", gpios[proto]);
}

if (sysfs_create_group(&pdev->dev.kobj, &uim_attr_grp)) {
pr_err(" sysfs entry creation failed");
return -1;
}
pr_info(" sysfs entries created ");
return ST_SUCCESS;
}

Expand All @@ -676,6 +705,7 @@ static int kim_remove(struct platform_device *pdev)
kim_gdata->rfkill[proto] = NULL;
}
pr_info("kim: GPIO Freed");
sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
kim_gdata->kim_pdev = NULL;
st_core_exit(kim_gdata->core_data);
return ST_SUCCESS;
Expand Down
11 changes: 11 additions & 0 deletions trunk/drivers/staging/ti-st/st_kim.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
* devices are created for the 3 gpios
* that ST has requested
*/

/* chip version storage
*/
struct chip_version {
unsigned short full;
unsigned short chip;
unsigned short min_ver;
unsigned short maj_ver;
};

/*
* header file for ST provided by KIM
*/
Expand All @@ -66,6 +76,7 @@ struct kim_data_s {
struct rfkill *rfkill[ST_MAX];
enum proto_type rf_protos[ST_MAX];
struct st_data_s *core_data;
struct chip_version version;
};

long st_kim_start(void);
Expand Down

0 comments on commit 30ba394

Please sign in to comment.