aboutsummaryrefslogtreecommitdiff
path: root/drivers/power/ftt_uevent.c
blob: 0aeb3e6698148469fbde7cbef9839e1f88928a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <linux/platform_device.h>
#include <linux/power_supply.h>

#include "ftt_ctrl_comm.h"
#include "ftt_status.h"


#if FTT_UEVENT
static enum power_supply_property ftt_charger_props[] = {
	POWER_SUPPLY_PROP_FTT_ANNTENA_LEVEL,
	POWER_SUPPLY_PROP_ONLINE,
};

static int ftt_get_property(struct power_supply *psy,
		enum power_supply_property psp,
		union power_supply_propval *val)
{
	struct ftt_charger_device *ftt_pdev = container_of(psy,
			struct ftt_charger_device, ftt_supply);

	switch (psp)
	{
		case POWER_SUPPLY_PROP_FTT_ANNTENA_LEVEL:
			val->intval = ftt_pdev->ant_level;
			break;
		case POWER_SUPPLY_PROP_ONLINE :
			val->intval = (int)ftt_pdev->ftt_online;
			break;
		default:
			return -EINVAL;
	}
	return 0;
}

void ftt_uevent_init(struct ftt_charger_device *ftt_pdev)
{
	ftt_pdev->ftt_supply.name		= FTT_POWER_SUPPLY;
	ftt_pdev->ftt_supply.type		= POWER_SUPPLY_TYPE_WIRELESS;
	ftt_pdev->ftt_supply.get_property	= ftt_get_property;
	ftt_pdev->ftt_supply.properties		= ftt_charger_props;
	ftt_pdev->ftt_supply.num_properties	= ARRAY_SIZE(ftt_charger_props);

	return;
}

#endif