Lines Matching +full:reset +full:- +full:mode

1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
27 struct gpio_desc *reset; member
38 /* put the device in reset */ in es7241_set_mode()
39 gpiod_set_value_cansleep(priv->reset, 0); in es7241_set_mode()
41 /* set the mode */ in es7241_set_mode()
42 gpiod_set_value_cansleep(priv->m0, m0); in es7241_set_mode()
43 gpiod_set_value_cansleep(priv->m1, m1); in es7241_set_mode()
45 /* take the device out of reset - datasheet does not specify a delay */ in es7241_set_mode()
46 gpiod_set_value_cansleep(priv->reset, 1); in es7241_set_mode()
50 const struct es7241_clock_mode *mode, in es7241_set_consumer_mode() argument
58 for (j = 0; j < mode->slv_mfs_num; j++) { in es7241_set_consumer_mode()
59 if (mode->slv_mfs[j] == mfs) in es7241_set_consumer_mode()
63 return -EINVAL; in es7241_set_consumer_mode()
71 const struct es7241_clock_mode *mode, in es7241_set_provider_mode() argument
78 if (mfs && mfs != mode->mst_mfs) in es7241_set_provider_mode()
79 return -EINVAL; in es7241_set_provider_mode()
81 es7241_set_mode(priv, mode->mst_m0, mode->mst_m1); in es7241_set_provider_mode()
92 unsigned int mfs = priv->mclk / rate; in es7241_hw_params()
95 for (i = 0; i < priv->chip->mode_num; i++) { in es7241_hw_params()
96 const struct es7241_clock_mode *mode = &priv->chip->modes[i]; in es7241_hw_params() local
98 if (rate < mode->rate_min || rate >= mode->rate_max) in es7241_hw_params()
101 if (priv->is_consumer) in es7241_hw_params()
102 return es7241_set_consumer_mode(priv, mode, mfs); in es7241_hw_params()
104 return es7241_set_provider_mode(priv, mode, mfs); in es7241_hw_params()
108 dev_err(dai->dev, "unsupported rate: %u\n", rate); in es7241_hw_params()
109 return -EINVAL; in es7241_hw_params()
118 priv->mclk = freq; in es7241_set_sysclk()
122 return -ENOTSUPP; in es7241_set_sysclk()
130 dev_err(dai->dev, "Unsupported dai clock inversion\n"); in es7241_set_fmt()
131 return -EINVAL; in es7241_set_fmt()
134 if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) != priv->fmt) { in es7241_set_fmt()
135 dev_err(dai->dev, "Invalid dai format\n"); in es7241_set_fmt()
136 return -EINVAL; in es7241_set_fmt()
141 priv->is_consumer = true; in es7241_set_fmt()
144 priv->is_consumer = false; in es7241_set_fmt()
148 dev_err(dai->dev, "Unsupported clock configuration\n"); in es7241_set_fmt()
149 return -EINVAL; in es7241_set_fmt()
162 .name = "es7241-hifi",
177 /* Single speed mode */
186 /* Double speed mode */
195 /* Quad speed mode */
243 * pull-up for i2s, pull-down for left justified. in es7241_parse_fmt()
245 is_leftj = of_property_read_bool(dev->of_node, in es7241_parse_fmt()
246 "everest,sdout-pull-down"); in es7241_parse_fmt()
248 priv->fmt = SND_SOC_DAIFMT_LEFT_J; in es7241_parse_fmt()
250 priv->fmt = SND_SOC_DAIFMT_I2S; in es7241_parse_fmt()
255 struct device *dev = &pdev->dev; in es7241_probe()
260 return -ENOMEM; in es7241_probe()
263 priv->chip = of_device_get_match_data(dev); in es7241_probe()
264 if (!priv->chip) { in es7241_probe()
266 return -ENODEV; in es7241_probe()
271 priv->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in es7241_probe()
272 if (IS_ERR(priv->reset)) in es7241_probe()
273 return dev_err_probe(dev, PTR_ERR(priv->reset), in es7241_probe()
274 "Failed to get 'reset' gpio"); in es7241_probe()
276 priv->m0 = devm_gpiod_get_optional(dev, "m0", GPIOD_OUT_LOW); in es7241_probe()
277 if (IS_ERR(priv->m0)) in es7241_probe()
278 return dev_err_probe(dev, PTR_ERR(priv->m0), in es7241_probe()
281 priv->m1 = devm_gpiod_get_optional(dev, "m1", GPIOD_OUT_LOW); in es7241_probe()
282 if (IS_ERR(priv->m1)) in es7241_probe()
283 return dev_err_probe(dev, PTR_ERR(priv->m1), in es7241_probe()
286 return devm_snd_soc_register_component(&pdev->dev, in es7241_probe()