/* The WM831x has a user key preventing writes to particularly critical registers. This function locks those registers, allowing writes to them.  */
void wm831x_reg_lock(struct wm831x *wm831x)
/* The WM831x has a user key preventing writes to particularly critical registers. This function locks those registers, allowing writes to them.  */
void wm831x_reg_lock(struct wm831x *wm831x)
{
	int ret;
	ret = wm831x_reg_write(wm831x, WM831X_SECURITY_KEY, 0);
	if (ret == 0) {
		dev_vdbg(wm831x->dev, "Registers locked\n");
		mutex_lock(&wm831x->io_lock);
		WARN_ON(wm831x->locked);
		wm831x->locked = 1;
		mutex_unlock(&wm831x->io_lock);
	} else {
		dev_err(wm831x->dev, "Failed to lock registers: %d\n", ret);
	}
}