Adds a function that detects when the cable is inserted.
BUG=chrome-os-partner:16196
TEST=Run on spring with verbose logging, plug in cable, and observe
"Detected cable insertion." in the logs.
Change-Id: I9a79e8755b6d4e402bf90d0f355b83762c270969
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48757
int reset_gpio;
int intp_gpio;
int cable_det_gpio;
int reset_gpio;
int intp_gpio;
int cable_det_gpio;
struct regulator *vdd_mydp;
struct i2c_client *tx_p0;
struct i2c_client *tx_p1;
struct regulator *vdd_mydp;
struct i2c_client *tx_p0;
struct i2c_client *tx_p1;
+static irqreturn_t anx7808_cable_det_isr(int irq, void *data)
+{
+ DRM_INFO("Detected cable insertion.\n");
+
+ return IRQ_HANDLED;
+}
+
static void anx7808_free_gpios(struct anx7808_data *anx7808)
{
gpio_free(anx7808->cable_det_gpio);
static void anx7808_free_gpios(struct anx7808_data *anx7808)
{
gpio_free(anx7808->cable_det_gpio);
+ anx7808->cable_det_irq = gpio_to_irq(anx7808->cable_det_gpio);
+ if (anx7808->cable_det_irq < 0) {
+ DRM_ERROR("Failed to get irq: %d\n", anx7808->cable_det_irq);
+ goto err_i2c;
+ }
+
+ ret = devm_request_irq(&client->dev,
+ anx7808->cable_det_irq,
+ anx7808_cable_det_isr,
+ IRQF_TRIGGER_RISING,
+ "anx7808_cable_det",
+ anx7808);
+ if (ret < 0) {
+ DRM_ERROR("Failed to request irq: %d\n", ret);
+ goto err_i2c;
+ }
+
DRM_INFO("ANX7808 initialization successful.\n");
return 0;
DRM_INFO("ANX7808 initialization successful.\n");
return 0;