diff --git a/gpio-util/argument.cpp b/gpio-util/argument.cpp
deleted file mode 100644
index 913313c..0000000
--- a/gpio-util/argument.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Copyright © 2017 IBM Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "argument.hpp"
-
-#include <algorithm>
-#include <iostream>
-#include <iterator>
-
-namespace phosphor
-{
-namespace gpio
-{
-
-ArgumentParser::ArgumentParser(int argc, char** argv)
-{
-    int option = 0;
-    while (-1 != (option = getopt_long(argc, argv, optionStr, options, NULL)))
-    {
-        if ((option == '?') || (option == 'h'))
-        {
-            usage(argv);
-            exit(-1);
-        }
-
-        auto i = &options[0];
-        while ((i->val != option) && (i->val != 0))
-        {
-            ++i;
-        }
-
-        if (i->val)
-        {
-            arguments[i->name] = (i->has_arg ? optarg : trueString);
-        }
-    }
-}
-
-const std::string& ArgumentParser::operator[](const std::string& opt)
-{
-    auto i = arguments.find(opt);
-    if (i == arguments.end())
-    {
-        return emptyString;
-    }
-    else
-    {
-        return i->second;
-    }
-}
-
-void ArgumentParser::usage(char** argv)
-{
-    std::cerr << "Usage: " << argv[0] << " [options]\n";
-    std::cerr << "Options:\n";
-    std::cerr << "    --help            Print this menu.\n";
-    std::cerr << "    --gpio=<gpio>     The GPIO number.  Example: 1\n";
-    std::cerr << "    --path=<path>     The path to the GPIO device."
-                 "  Example: /dev/gpiochip0\n";
-    std::cerr << "    --delay=<delay>   The delay in ms in between a toggle."
-                 "  Example: 5\n";
-    std::cerr << "    --action=<action> The action to do.\n";
-    std::cerr << "                      Valid actions: low, high, low_high, "
-                 "high_low\n";
-    std::cerr << std::flush;
-}
-
-const option ArgumentParser::options[] = {
-    {"action", required_argument, NULL, 'a'},
-    {"gpio", required_argument, NULL, 'g'},
-    {"delay", required_argument, NULL, 'd'},
-    {"path", required_argument, NULL, 'p'},
-    {"help", no_argument, NULL, 'h'},
-    {0, 0, 0, 0},
-};
-
-const char* ArgumentParser::optionStr = "a:g:d:p:h?";
-
-const std::string ArgumentParser::trueString = "true";
-const std::string ArgumentParser::emptyString = "";
-
-} // namespace gpio
-} // namespace phosphor
diff --git a/gpio-util/argument.hpp b/gpio-util/argument.hpp
deleted file mode 100644
index 7917b8a..0000000
--- a/gpio-util/argument.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#pragma once
-
-#include <getopt.h>
-
-#include <map>
-#include <string>
-
-namespace phosphor
-{
-namespace gpio
-{
-/** @brief Class - Encapsulates parsing command line options and
- *                 populating arguments
- */
-class ArgumentParser
-{
-  public:
-    ArgumentParser() = delete;
-    ~ArgumentParser() = default;
-    ArgumentParser(const ArgumentParser&) = delete;
-    ArgumentParser& operator=(const ArgumentParser&) = delete;
-    ArgumentParser(ArgumentParser&&) = default;
-    ArgumentParser& operator=(ArgumentParser&&) = default;
-
-    /** @brief Constructs Argument object
-     *
-     *  @param argc - the main function's argc passed as is
-     *  @param argv - the main function's argv passed as is
-     *  @return Object constructed
-     */
-    ArgumentParser(int argc, char** argv);
-
-    /** @brief Given an option, returns its argument(optarg)
-     *
-     *  @param opt - command line option string
-     *
-     *  @return argument which is a standard optarg
-     */
-    const std::string& operator[](const std::string& opt);
-
-    /** @brief Displays usage
-     *
-     *  @param argv - the main function's argv passed as is
-     */
-    static void usage(char** argv);
-
-    /** @brief Set to 'true' when an option is passed */
-    static const std::string trueString;
-
-    /** @brief Set to '' when an option is not passed */
-    static const std::string emptyString;
-
-  private:
-    /** @brief Option to argument mapping */
-    std::map<const std::string, std::string> arguments;
-
-    /** @brief Array of struct options as needed by getopt_long */
-    static const option options[];
-
-    /** @brief optstring as needed by getopt_long */
-    static const char* optionStr;
-};
-
-} // namespace gpio
-} // namespace phosphor
diff --git a/gpio-util/gpio.cpp b/gpio-util/gpio.cpp
deleted file mode 100644
index 0e825b9..0000000
--- a/gpio-util/gpio.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright © 2017 IBM Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "gpio.hpp"
-
-#include <fcntl.h>
-#include <sys/ioctl.h>
-
-#include <phosphor-logging/lg2.hpp>
-
-#include <cassert>
-#include <cstring>
-
-namespace phosphor
-{
-namespace gpio
-{
-
-void GPIO::set(Value value)
-{
-    assert(direction == Direction::output);
-
-    requestLine(value);
-
-    gpiohandle_data data{};
-    data.values[0] = static_cast<gpioValue_t>(value);
-
-    auto rc = ioctl(lineFD(), GPIOHANDLE_SET_LINE_VALUES_IOCTL, &data);
-    if (rc == -1)
-    {
-        lg2::error("Failed SET_LINE_VALUES ioctl: {ERRNO}", "ERRNO", errno);
-        throw std::runtime_error("Failed SET_LINE_VALUES ioctl");
-    }
-}
-
-void GPIO::requestLine(Value defaultValue)
-{
-    // Only need to do this once
-    if (lineFD)
-    {
-        return;
-    }
-
-    FileDescriptor fd{open(device.c_str(), 0)};
-    if (fd() == -1)
-    {
-        lg2::error("Failed opening {DEVICE}: {ERRNO}", "DEVICE", device,
-                   "ERRNO", errno);
-        throw std::runtime_error("Failed opening GPIO device");
-    }
-
-    // Make an ioctl call to request the GPIO line, which will
-    // return the descriptor to use to access it.
-    gpiohandle_request request{};
-    strncpy(request.consumer_label, "phosphor-gpio-util",
-            sizeof(request.consumer_label));
-
-    request.flags = (direction == Direction::output) ? GPIOHANDLE_REQUEST_OUTPUT
-                                                     : GPIOHANDLE_REQUEST_INPUT;
-
-    request.lineoffsets[0] = gpio;
-    request.lines = 1;
-
-    if (direction == Direction::output)
-    {
-        request.default_values[0] = static_cast<gpioValue_t>(defaultValue);
-    }
-
-    auto rc = ioctl(fd(), GPIO_GET_LINEHANDLE_IOCTL, &request);
-    if (rc == -1)
-    {
-        lg2::error("Failed GET_LINEHANDLE ioctl {GPIO}: {ERRNO}", "GPIO", gpio,
-                   "ERRNO", errno);
-        throw std::runtime_error("Failed GET_LINEHANDLE ioctl");
-    }
-
-    lineFD.set(request.fd);
-}
-
-} // namespace gpio
-} // namespace phosphor
diff --git a/gpio-util/gpio.hpp b/gpio-util/gpio.hpp
deleted file mode 100644
index 46b6fba..0000000
--- a/gpio-util/gpio.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-#pragma once
-
-#include "file.hpp"
-
-#include <linux/gpio.h>
-
-#include <string>
-#include <type_traits>
-
-namespace phosphor
-{
-namespace gpio
-{
-
-typedef std::remove_reference<
-    decltype(gpiohandle_request::lineoffsets[0])>::type gpioNum_t;
-
-typedef std::remove_reference<decltype(gpiohandle_data::values[0])>::type
-    gpioValue_t;
-
-/**
- * Represents a GPIO.
- *
- * Operations are setting low or high.
- *
- * Read support may be added in the future.
- */
-class GPIO
-{
-  public:
-    /**
-     * If the GPIO is an input or output
-     */
-    enum class Direction
-    {
-        input,
-        output
-    };
-
-    /**
-     * The possible values - low or high
-     */
-    enum class Value
-    {
-        low,
-        high
-    };
-
-    GPIO() = delete;
-    GPIO(const GPIO&) = delete;
-    GPIO(GPIO&&) = default;
-    GPIO& operator=(const GPIO&) = delete;
-    GPIO& operator=(GPIO&&) = default;
-    ~GPIO() = default;
-
-    /**
-     * Constructor
-     *
-     * @param[in] device - the GPIO device file
-     * @param[in] gpio - the GPIO number
-     * @param[in] direction - the GPIO direction
-     */
-    GPIO(const std::string& device, gpioNum_t gpio, Direction direction) :
-        device(device), gpio(gpio), direction(direction)
-    {}
-
-    /**
-     * Sets the GPIO value
-     *
-     * Requests the GPIO line if it hasn't been done already.
-     */
-    void set(Value value);
-
-  private:
-    /**
-     * Requests a GPIO line from the GPIO device
-     *
-     * @param[in] defaultValue - The default value, required for
-     *                           output GPIOs only.
-     */
-    void requestLine(Value defaultValue = Value::high);
-
-    /**
-     * The GPIO device name, like /dev/gpiochip0
-     */
-    const std::string device;
-
-    /**
-     * The GPIO number
-     */
-    const gpioNum_t gpio;
-
-    /**
-     * The GPIO direction
-     */
-    const Direction direction;
-
-    /**
-     * File descriptor for the GPIO line
-     */
-    FileDescriptor lineFD;
-};
-
-} // namespace gpio
-} // namespace phosphor
diff --git a/gpio-util/main.cpp b/gpio-util/main.cpp
deleted file mode 100644
index d7cdc3d..0000000
--- a/gpio-util/main.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * Copyright © 2017 IBM Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * This program is a utility for accessing GPIOs.
- * Actions:
- *   low:  Set a GPIO low
- *   high: Set a GPIO high
- *   low_high: Set a GPIO low, delay if requested, set it high
- *   high_low: Set a GPIO high, delay if requested, set it low
- */
-
-#include "argument.hpp"
-#include "gpio.hpp"
-
-#include <algorithm>
-#include <chrono>
-#include <iostream>
-#include <map>
-#include <thread>
-
-using namespace phosphor::gpio;
-
-typedef void (*gpioFunction)(GPIO&, unsigned int);
-using gpioFunctionMap = std::map<std::string, gpioFunction>;
-
-/**
- * Sets a GPIO low
- *
- * @param[in] gpio - the GPIO object
- * @param[in] delayInMS - Unused in this function
- */
-void low(GPIO& gpio, unsigned int)
-{
-    gpio.set(GPIO::Value::low);
-}
-
-/**
- * Sets a GPIO high
- *
- * @param[in] gpio - the GPIO object
- * @param[in] delayInMS - Unused in this function
- */
-void high(GPIO& gpio, unsigned int)
-{
-    gpio.set(GPIO::Value::high);
-}
-
-/**
- * Sets a GPIO high, then delays, then sets it low
- *
- * @param[in] gpio - the GPIO object
- * @param[in] delayInMS - The delay in between the sets
- */
-void highLow(GPIO& gpio, unsigned int delayInMS)
-{
-    gpio.set(GPIO::Value::high);
-
-    std::chrono::milliseconds delay{delayInMS};
-    std::this_thread::sleep_for(delay);
-
-    gpio.set(GPIO::Value::low);
-}
-
-/**
- * Sets a GPIO low, then delays, then sets it high
- *
- * @param[in] gpio - the GPIO to write
- * @param[in] delayInMS - The delay in between the sets
- */
-void lowHigh(GPIO& gpio, unsigned int delayInMS)
-{
-    gpio.set(GPIO::Value::low);
-
-    std::chrono::milliseconds delay{delayInMS};
-    std::this_thread::sleep_for(delay);
-
-    gpio.set(GPIO::Value::high);
-}
-
-/**
- * The actions supported by this program
- */
-static const gpioFunctionMap functions{
-    {"low", low}, {"high", high}, {"low_high", lowHigh}, {"high_low", highLow}};
-
-/**
- * Prints usage and exits the program
- *
- * @param[in] err - the error message to print
- * @param[in] argv - argv from main()
- */
-void exitWithError(const char* err, char** argv)
-{
-    std::cerr << "ERROR: " << err << "\n";
-    ArgumentParser::usage(argv);
-    exit(EXIT_FAILURE);
-}
-
-/**
- * Returns the number value of the argument passed in.
- *
- * @param[in] name - the argument name
- * @param[in] parser - the argument parser
- * @param[in] argv - arv from main()
- */
-template <typename T>
-T getValueFromArg(const char* name, ArgumentParser& parser, char** argv)
-{
-    char* p = NULL;
-    auto val = strtol(parser[name].c_str(), &p, 10);
-
-    // strol sets p on error, also we don't allow negative values
-    if (*p || (val < 0))
-    {
-        using namespace std::string_literals;
-        std::string msg = "Invalid "s + name + " value passed in";
-        exitWithError(msg.c_str(), argv);
-    }
-    return static_cast<T>(val);
-}
-
-int main(int argc, char** argv)
-{
-    ArgumentParser args(argc, argv);
-
-    auto path = args["path"];
-    if (path == ArgumentParser::emptyString)
-    {
-        exitWithError("GPIO device path not specified", argv);
-    }
-
-    auto action = args["action"];
-    if (action == ArgumentParser::emptyString)
-    {
-        exitWithError("Action not specified", argv);
-    }
-
-    if (args["gpio"] == ArgumentParser::emptyString)
-    {
-        exitWithError("GPIO not specified", argv);
-    }
-
-    auto gpioNum = getValueFromArg<gpioNum_t>("gpio", args, argv);
-
-    // Not all actions require a delay, so not required
-    unsigned int delay = 0;
-    if (args["delay"] != ArgumentParser::emptyString)
-    {
-        delay = getValueFromArg<decltype(delay)>("delay", args, argv);
-    }
-
-    auto function = functions.find(action);
-    if (function == functions.end())
-    {
-        exitWithError("Invalid action value passed in", argv);
-    }
-
-    GPIO gpio{path, gpioNum, GPIO::Direction::output};
-
-    try
-    {
-        function->second(gpio, delay);
-    }
-    catch (const std::runtime_error& e)
-    {
-        std::cerr << e.what();
-        return -1;
-    }
-
-    return 0;
-}
diff --git a/gpio-util/meson.build b/gpio-util/meson.build
deleted file mode 100644
index d14cbc3..0000000
--- a/gpio-util/meson.build
+++ /dev/null
@@ -1,12 +0,0 @@
-executable(
-    'phosphor-gpio-util',
-    'argument.cpp',
-    'gpio.cpp',
-    'main.cpp',
-    dependencies: [
-        phosphor_logging,
-    ],
-    include_directories: '..',
-    implicit_include_directories: false,
-    install: true,
-)
diff --git a/meson.build b/meson.build
index ffb3442..0164b88 100644
--- a/meson.build
+++ b/meson.build
@@ -154,6 +154,5 @@
     install: true,
 )
 
-subdir('gpio-util')
 subdir('presence')
 subdir('test')
