Re: [PATCH V1 2/2] ASoC: codecs: Add aw88166 amplifier driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 21, 2025 at 06:26:23PM +0800, wangweidong.a@xxxxxxxxxx wrote:
> +
> +static void aw88166_hw_reset(struct aw88166 *aw88166)
> +{
> +	if (aw88166->reset_gpio) {
> +		gpiod_set_value_cansleep(aw88166->reset_gpio, 1);
> +		usleep_range(AW88166_1000_US, AW88166_1000_US + 10);
> +		gpiod_set_value_cansleep(aw88166->reset_gpio, 0);
> +		usleep_range(AW88166_1000_US, AW88166_1000_US + 10);
> +		gpiod_set_value_cansleep(aw88166->reset_gpio, 1);

Why do you keep reset as active after reset? How is it suppose to work?

> +		usleep_range(AW88166_1000_US, AW88166_1000_US + 10);
> +	}
> +}
> +
> +static void aw88166_parse_channel_dt(struct aw88166 *aw88166)
> +{
> +	struct aw_device *aw_dev = aw88166->aw_pa;
> +	struct device_node *np = aw_dev->dev->of_node;
> +	u32 channel_value;
> +
> +	of_property_read_u32(np, "awinic,audio-channel", &channel_value);
> +	aw_dev->channel = channel_value;
> +	aw88166->phase_sync = of_property_read_bool(np, "awinic,sync-flag");
> +}
> +
> +static int aw88166_init(struct aw88166 *aw88166, struct i2c_client *i2c, struct regmap *regmap)
> +{
> +	struct aw_device *aw_dev;
> +	unsigned int chip_id;
> +	int ret;
> +
> +	ret = regmap_read(regmap, AW88166_ID_REG, &chip_id);
> +	if (ret) {
> +		dev_err(&i2c->dev, "%s read chipid error. ret = %d\n", __func__, ret);
> +		return ret;
> +	}
> +
> +	aw_dev = devm_kzalloc(&i2c->dev, sizeof(*aw_dev), GFP_KERNEL);
> +	if (!aw_dev)
> +		return -ENOMEM;
> +	aw88166->aw_pa = aw_dev;
> +
> +	aw_dev->i2c = i2c;
> +	aw_dev->dev = &i2c->dev;
> +	aw_dev->regmap = regmap;
> +	mutex_init(&aw_dev->dsp_lock);
> +
> +	aw_dev->chip_id = chip_id;
> +	aw_dev->acf = NULL;
> +	aw_dev->prof_info.prof_desc = NULL;
> +	aw_dev->prof_info.count = 0;
> +	aw_dev->prof_info.prof_type = AW88395_DEV_NONE_TYPE_ID;
> +	aw_dev->channel = AW88166_DEV_DEFAULT_CH;
> +	aw_dev->fw_status = AW88166_DEV_FW_FAILED;
> +
> +	aw_dev->fade_step = AW88166_VOLUME_STEP_DB;
> +	aw_dev->volume_desc.ctl_volume = AW88166_VOL_DEFAULT_VALUE;
> +
> +	aw88166_parse_channel_dt(aw88166);
> +
> +	return 0;
> +}
> +
> +static int aw88166_i2c_probe(struct i2c_client *i2c)
> +{
> +	struct aw88166 *aw88166;
> +	int ret;
> +
> +	if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C))
> +		return dev_err_probe(&i2c->dev, -ENXIO, "check_functionality failed\n");
> +
> +	aw88166 = devm_kzalloc(&i2c->dev, sizeof(*aw88166), GFP_KERNEL);
> +	if (!aw88166)
> +		return -ENOMEM;
> +
> +	mutex_init(&aw88166->lock);
> +
> +	i2c_set_clientdata(i2c, aw88166);
> +
> +	aw88166->reset_gpio = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW);


So here reset is low...

> +	if (IS_ERR(aw88166->reset_gpio))
> +		return dev_err_probe(&i2c->dev, PTR_ERR(aw88166->reset_gpio),
> +							"reset gpio not defined\n");
> +	aw88166_hw_reset(aw88166);

and here is high afterwards?

Best regards,
Krzysztof





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux