How to solve a differential equation like this one? [closed]

Does anyone know how to solve this equation in Mathematica

dx/dt = f(x) + u

where

f(x) = -x, if x < 1 or x = 1

closed as off-topic by Michael E2, rhermans, garej, Henrik Schumacher, bbgodfreyJul 12 at 0:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, rhermans, garej, Henrik Schumacher, bbgodfrey
If this question can be reworded to fit the rules in the help center, please edit the question.

• Look at Piecewise to define the function and at DSolve for the solution of the differential equation. – bill s Jul 6 at 16:55
• I have written Dsolve[x'[t] == u + f[x], x[t], t] but I don't know how to continue. Do you have any idea? – Evina Jul 6 at 17:10
• Try DSolve instead of Dsolve. You can look up the help file by typing ?DSolve. – Bill Watts Jul 6 at 17:29
• It's my mistake! I have written DSolve, my problem is how we solve the equation when we have the condition "x<1 or x=1". – Evina Jul 6 at 17:37

"$$x<1$$ or $$x=1$$" is simply $$x\le1$$. I'm assuming that $$f(x)=0$$ for $$x>1$$; please specify if this is not true. 