Lines Matching defs:aw_dev

26 static int aw87390_dev_reg_update(struct aw_device *aw_dev,
32 dev_err(aw_dev->dev, "data is NULL\n");
42 ret = regmap_write(aw_dev->regmap, data[i], data[i + 1]);
50 static int aw87390_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name)
52 struct aw_prof_info *prof_info = &aw_dev->prof_info;
55 if ((index >= aw_dev->prof_info.count) || (index < 0)) {
56 dev_err(aw_dev->dev, "index[%d] overflow count[%d]\n",
57 index, aw_dev->prof_info.count);
61 prof_desc = &aw_dev->prof_info.prof_desc[index];
68 static int aw87390_dev_get_prof_data(struct aw_device *aw_dev, int index,
71 if ((index >= aw_dev->prof_info.count) || (index < 0)) {
72 dev_err(aw_dev->dev, "%s: index[%d] overflow count[%d]\n",
73 __func__, index, aw_dev->prof_info.count);
77 *prof_desc = &aw_dev->prof_info.prof_desc[index];
82 static int aw87390_dev_fw_update(struct aw_device *aw_dev)
89 ret = aw87390_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name);
91 dev_err(aw_dev->dev, "get prof name failed\n");
95 dev_dbg(aw_dev->dev, "start update %s", prof_name);
97 ret = aw87390_dev_get_prof_data(aw_dev, aw_dev->prof_index, &prof_index_desc);
99 dev_err(aw_dev->dev, "aw87390_dev_get_prof_data failed\n");
105 ret = aw87390_dev_reg_update(aw_dev, sec_desc[AW88395_DATA_TYPE_REG].data,
108 dev_err(aw_dev->dev, "update reg failed\n");
112 aw_dev->prof_cur = aw_dev->prof_index;
117 static int aw87390_power_off(struct aw_device *aw_dev)
121 if (aw_dev->status == AW87390_DEV_PW_OFF) {
122 dev_dbg(aw_dev->dev, "already power off\n");
126 ret = regmap_write(aw_dev->regmap, AW87390_SYSCTRL_REG, AW87390_POWER_DOWN_VALUE);
129 aw_dev->status = AW87390_DEV_PW_OFF;
134 static int aw87390_power_on(struct aw_device *aw_dev)
138 if (aw_dev->status == AW87390_DEV_PW_ON) {
139 dev_dbg(aw_dev->dev, "already power on\n");
143 if (!aw_dev->fw_status) {
144 dev_err(aw_dev->dev, "fw not load\n");
148 ret = regmap_write(aw_dev->regmap, AW87390_SYSCTRL_REG, AW87390_POWER_DOWN_VALUE);
152 ret = aw87390_dev_fw_update(aw_dev);
154 dev_err(aw_dev->dev, "%s load profile failed\n", __func__);
157 aw_dev->status = AW87390_DEV_PW_ON;
162 static int aw87390_dev_set_profile_index(struct aw_device *aw_dev, int index)
164 if ((index >= aw_dev->prof_info.count) || (index < 0))
167 if (aw_dev->prof_index == index)
170 aw_dev->prof_index = index;
289 dev_err(aw87390->aw_pa->dev, "aw_dev acf parse failed\n");
301 struct aw_device *aw_dev = aw87390->aw_pa;
306 ret = aw87390_power_on(aw_dev);
309 ret = aw87390_power_off(aw_dev);
312 dev_err(aw_dev->dev, "%s: invalid event %d\n", __func__, event);
356 struct aw_device *aw_dev = aw87390->aw_pa;
357 struct device_node *np = aw_dev->dev->of_node;
362 aw_dev->channel = channel_value;
367 struct aw_device *aw_dev;
385 aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL);
386 if (!aw_dev)
389 (*aw87390)->aw_pa = aw_dev;
390 aw_dev->i2c = i2c;
391 aw_dev->regmap = regmap;
392 aw_dev->dev = &i2c->dev;
393 aw_dev->chip_id = AW87390_CHIP_ID;
394 aw_dev->acf = NULL;
395 aw_dev->prof_info.prof_desc = NULL;
396 aw_dev->prof_info.count = 0;
397 aw_dev->prof_info.prof_type = AW88395_DEV_NONE_TYPE_ID;
398 aw_dev->channel = AW87390_DEV_DEFAULT_CH;
399 aw_dev->fw_status = AW87390_DEV_FW_FAILED;
400 aw_dev->prof_index = AW87390_INIT_PROFILE;
401 aw_dev->status = AW87390_DEV_PW_OFF;