lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 29 Mar 2015 22:07:38 -0700
From:	Andrew Bresticker <abrestic@...omium.org>
To:	Jonathan Cameron <jic23@...nel.org>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	linux-input@...r.kernel.org,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	linux-iio@...r.kernel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] Input: Add driver for a generic ADC keypad

On Sat, Mar 28, 2015 at 7:02 AM, Jonathan Cameron <jic23@...nel.org> wrote:
> On 28/03/15 00:43, Andrew Bresticker wrote:
>> Add a polled input driver for a keypad in which the buttons are connected
>> in resistor ladders to an ADC.  The IIO framework is used to claim and
>> read the ADC channels.
>>
>> Signed-off-by: Andrew Bresticker <abrestic@...omium.org>

>> +static int adc_keypad_probe(struct platform_device *pdev)
>> +{
>> +     struct adc_keypad *keypad;
>> +     struct input_polled_dev *poll_dev;
>> +     struct input_dev *input;
>> +     unsigned int i;
>> +     int ret;
>> +
>> +     keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL);
>> +     if (!keypad)
>> +             return -ENOMEM;
>> +     keypad->dev = &pdev->dev;
>> +     platform_set_drvdata(pdev, keypad);
>> +
>> +     keypad->iio_chans = iio_channel_get_all(&pdev->dev);
>> +     if (IS_ERR(keypad->iio_chans)) {
>> +             dev_err(&pdev->dev, "Failed to get IIO channels: %ld\n",
>> +                     PTR_ERR(keypad->iio_chans));
>> +             return PTR_ERR(keypad->iio_chans);
>> +     }
>> +
>> +     i = 0;
>> +     while (keypad->iio_chans[i].channel != NULL)
>> +             i++;
>> +     keypad->num_chans = i;
>> +     keypad->chan_map = devm_kcalloc(&pdev->dev, keypad->num_chans,
>> +                                     sizeof(*keypad->chan_map), GFP_KERNEL);
>> +     if (!keypad->chan_map) {
>> +             ret = -ENOMEM;
>> +             goto put_chans;
>> +     }
>> +
>> +     ret = adc_keypad_of_parse(keypad);
>> +     if (ret < 0)
>> +             goto put_chans;
>> +
>> +     poll_dev = devm_input_allocate_polled_device(&pdev->dev);
>> +     if (!poll_dev) {
>> +             ret = -ENOMEM;
>> +             goto put_chans;
>> +     }
>> +     keypad->poll_dev = poll_dev;
>> +
>> +     poll_dev->private = keypad;
>> +     poll_dev->poll = adc_keypad_poll;
>> +     poll_dev->poll_interval = keypad->poll_interval;
>> +
>> +     input = poll_dev->input;
>> +     input->name = pdev->name;
>> +     input->phys = "adc-keys/input0";
>> +
>> +     input->id.bustype = BUS_HOST;
>> +     input->id.vendor = 0x0001;
>> +     input->id.product = 0x0001;
>> +     input->id.version = 0x0100;

> Why these particular values?

I just chose these because these are the values most other platform
input devices use, including gpio_keys and gpio_keys_polled.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ