Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2f17948 authored by Tony SIM's avatar Tony SIM Committed by Greg Kroah-Hartman
Browse files

staging: iio: ak8975: add platform data.



As some of the platform not support irq_to_gpio, we pass gpio port
by platform data.

Signed-off-by: default avatarTony SIM <chinyeow.sim.xt@renesas.com>
Signed-off-by: default avatarAndrew Chew <achew@nvidia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ea801950
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@
#include <linux/delay.h>
#include <linux/delay.h>


#include <linux/gpio.h>
#include <linux/gpio.h>
#include <linux/input/ak8975.h>


#include "../iio.h"
#include "../iio.h"
#include "magnet.h"
#include "magnet.h"
@@ -435,6 +436,7 @@ static int ak8975_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
			const struct i2c_device_id *id)
{
{
	struct ak8975_data *data;
	struct ak8975_data *data;
	struct ak8975_platform_data *pdata;
	int err;
	int err;


	/* Allocate our device context. */
	/* Allocate our device context. */
@@ -452,6 +454,10 @@ static int ak8975_probe(struct i2c_client *client,


	/* Grab and set up the supplied GPIO. */
	/* Grab and set up the supplied GPIO. */
	data->eoc_irq = client->irq;
	data->eoc_irq = client->irq;
	pdata = client->dev.platform_data;
	if (pdata)
		data->eoc_gpio = pdata->gpio;
	else
		data->eoc_gpio = irq_to_gpio(client->irq);
		data->eoc_gpio = irq_to_gpio(client->irq);


	if (!data->eoc_gpio) {
	if (!data->eoc_gpio) {
+20 −0
Original line number Original line Diff line number Diff line
/*
 * ak8975 platform support
 *
 * Copyright (C) 2010 Renesas Solutions Corp.
 *
 * Author: Tony SIM <chinyeow.sim.xt@renesas.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _AK8975_H
#define _AK8975_H

struct ak8975_platform_data {
	int gpio;
};

#endif