![Oscillator.](https://i.stack.imgur.com/Ge7Qb.png)
Firstly, for clarity add an $x$-axis.
You correctly, in the absence of friction, wrote the Total Energy (Hamiltonian) equation as:
$$\frac {Iw^2}{2} + \frac {mv^2}{2} + \frac {kx^2}{2} = mgh$$
With the new $x$-axis:
$$\frac {Iw^2}{2} + \frac {mv^2}{2} + \frac {kx^2}{2} = mgx$$
You also correctly stated that $v=\frac{dx}{dt}=r\omega$, so that with substitution we get:
$$\big(\frac{I}{2r^2}+\frac{m}{2}\big)v^2+\frac{kx^2}{2}=mgx$$
For simplicity, set:
$$\alpha=\big(\frac{I}{2r^2}+\frac{m}{2}\big)$$
So:
$$\alpha v^2+\frac{kx^2}{2}=mgx$$
Now derive both sides to $t$, which gives us the Newtonian equation of motion:
$$2\alpha v\frac{dv}{dt}+kx\frac{dx}{dt}=mg\frac{dx}{dt}$$
$$2\alpha va+kxv=mgv$$
$v$ cancels out, so:
$$2\alpha a+kx=mg$$
Or:
$$2\alpha \frac{d^2x}{dt^2}+kx-mg=0$$
Which has the general solution:
$$x(t)=\frac{mg}{k}+c_1\sin(\sqrt{\frac{k}{2\alpha}}t)+c_2\cos(\sqrt{\frac{k}{2\alpha}}t)$$
Use initial conditions (e.g. $t=0$, $v=0$, $x=x_0$) to determine $c_1$ and $c_2$:
$$x(t)=\frac{mg}{k}+\big(x_0-\frac{mg}{k}\big)\cos\big(\sqrt{\frac{k}{2\alpha}}t\big)$$
So the mass enters into a simple harmonic oscillation.
What we mean by a frictionless pulley is that the friction in the bearings of the pulley is negligible, and the pulley is free to rotate without any resistance. We don't mean that the friction between the string and the pulley surface is negligible. In fact, we assume that there is enough static friction between the string and pulley surface to prevent the string from slipping. But, in this case, if you do a moment balance on the pulley, you must then conclude that the tensions in the string on either side are equal (even if the pulley has angular acceleration), since the moment of inertia of the pulley is assumed to be zero.
Best Answer
The torque that is applied to the pulley is created by friction between string and pulley. String has no mass but it has acceleration. So the force and torque that are applied to it must be zero. $$\sum{\tau}=I\alpha\;,\,\;I=0\;\Rightarrow\sum{\tau}=0$$ Free body diagram of string is shown below:
If we write $\sum{\tau}$ about center of pulley, then we have:$$\sum{\tau}=T_2r-\int_0^\theta r\mathrm dF_f-T_1r=0$$ Consider that $\vec N=\int_0^\theta \mathrm d\vec N$ passes from center of pulley and its torque is zero (all of $\color{red}{\mathrm dN}$s pass from center of pulley). So, we have:$$\int_0^\theta r\mathrm dF_f=\left(T_2-T_1\right)r$$ And according to the third law of newton, this torque is applied to pulley in the inverse direction.