/* @wm831x: Device to write to. @reg: Register to write to. @mask: Mask of bits to set. @val: Value to set (unshifted)  */
int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg, unsigned short mask, unsigned short val)
/* @wm831x: Device to write to. @reg: Register to write to. @mask: Mask of bits to set. @val: Value to set (unshifted)  */
int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg, unsigned short mask, unsigned short val)
{
	int ret;
	u16 r;
	mutex_lock(&wm831x->io_lock);
	ret = wm831x_read(wm831x, reg, 2, &r);
	if (ret < 0)
		goto out;
	r &= ~mask;
	r |= val;
	ret = wm831x_write(wm831x, reg, 2, &r);
out:
	mutex_unlock(&wm831x->io_lock);
	return ret;
}