Voltage optimization and control becomes imperative with increased use of distributed energy resources in distribution feeders. Smart inverters (SIs) can be used effectively for voltage control and optimization especially for fast varying voltage fluctuation caused by high photovoltaic penetration. The local voltage control settings of SIs are typically obtained using rule-based or sensitivity-based methods. This paper presents an optimization framework to find the SIs' local volt-var and volt-watt settings that support certain grid level objectives. In this context, we develop an optimal power flow (OPF) model by integrating SIs' volt-var and volt-watt droop settings as optimization variables. We demonstrate the efficacy of the proposed method using the IEEE 123-node system with 10 SIs (5 in volt-var mode and 5 in volt-watt mode). The results show that it is feasible to obtain optimal droop settings of SIs for autonomous voltage and reactive power control that benefits the grid operations.