drivers/iio/light/lv0104cs.c

Source file repositories/reference/linux-study-clean/drivers/iio/light/lv0104cs.c

File Facts

System
Linux kernel
Corpus path
drivers/iio/light/lv0104cs.c
Extension
.c
Size
11730 bytes
Lines
530
Domain
Driver Families
Bucket
drivers/iio
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct lv0104cs_private {
	struct i2c_client *client;
	struct mutex lock;
	u8 calibscale;
	u8 scale;
	u8 int_time;
};

struct lv0104cs_mapping {
	int val;
	int val2;
	u8 regval;
};

static const struct lv0104cs_mapping lv0104cs_calibscales[] = {
	{ 0, 666666, 0x81 },
	{ 0, 800000, 0x82 },
	{ 0, 857142, 0x83 },
	{ 0, 888888, 0x84 },
	{ 0, 909090, 0x85 },
	{ 0, 923076, 0x86 },
	{ 0, 933333, 0x87 },
	{ 0, 941176, 0x88 },
	{ 0, 947368, 0x89 },
	{ 0, 952380, 0x8A },
	{ 0, 956521, 0x8B },
	{ 0, 960000, 0x8C },
	{ 0, 962962, 0x8D },
	{ 0, 965517, 0x8E },
	{ 0, 967741, 0x8F },
	{ 0, 969696, 0x90 },
	{ 0, 971428, 0x91 },
	{ 0, 972972, 0x92 },
	{ 0, 974358, 0x93 },
	{ 0, 975609, 0x94 },
	{ 0, 976744, 0x95 },
	{ 0, 977777, 0x96 },
	{ 0, 978723, 0x97 },
	{ 0, 979591, 0x98 },
	{ 0, 980392, 0x99 },
	{ 0, 981132, 0x9A },
	{ 0, 981818, 0x9B },
	{ 0, 982456, 0x9C },
	{ 0, 983050, 0x9D },
	{ 0, 983606, 0x9E },
	{ 0, 984126, 0x9F },
	{ 1, 0, 0x80 },
	{ 1, 16129, 0xBF },
	{ 1, 16666, 0xBE },
	{ 1, 17241, 0xBD },
	{ 1, 17857, 0xBC },
	{ 1, 18518, 0xBB },
	{ 1, 19230, 0xBA },
	{ 1, 20000, 0xB9 },
	{ 1, 20833, 0xB8 },
	{ 1, 21739, 0xB7 },
	{ 1, 22727, 0xB6 },
	{ 1, 23809, 0xB5 },
	{ 1, 24999, 0xB4 },
	{ 1, 26315, 0xB3 },
	{ 1, 27777, 0xB2 },
	{ 1, 29411, 0xB1 },
	{ 1, 31250, 0xB0 },
	{ 1, 33333, 0xAF },
	{ 1, 35714, 0xAE },
	{ 1, 38461, 0xAD },
	{ 1, 41666, 0xAC },
	{ 1, 45454, 0xAB },
	{ 1, 50000, 0xAA },
	{ 1, 55555, 0xA9 },
	{ 1, 62500, 0xA8 },
	{ 1, 71428, 0xA7 },
	{ 1, 83333, 0xA6 },
	{ 1, 100000, 0xA5 },
	{ 1, 125000, 0xA4 },
	{ 1, 166666, 0xA3 },
	{ 1, 250000, 0xA2 },
	{ 1, 500000, 0xA1 },
};

static const struct lv0104cs_mapping lv0104cs_scales[] = {
	{ 0, 250000, LV0104CS_SCALE_0_25X << LV0104CS_SCALE_SHIFT },
	{ 1, 0, LV0104CS_SCALE_1X << LV0104CS_SCALE_SHIFT },
	{ 2, 0, LV0104CS_SCALE_2X << LV0104CS_SCALE_SHIFT },
	{ 8, 0, LV0104CS_SCALE_8X << LV0104CS_SCALE_SHIFT },
};

static const struct lv0104cs_mapping lv0104cs_int_times[] = {
	{ 0, 12500, LV0104CS_INTEG_12_5MS << LV0104CS_INTEG_SHIFT },
	{ 0, 100000, LV0104CS_INTEG_100MS << LV0104CS_INTEG_SHIFT },

Annotation

Implementation Notes