* Re: [v3, 3/4] i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller
From: Doug Anderson @ 2018-03-08 5:19 UTC (permalink / raw)
To: Sagar Dharia
Cc: Jonathan Corbet, Andy Gross, David Brown, Rob Herring,
Mark Rutland, Wolfram Sang, Greg Kroah-Hartman,
Karthikeyan Ramasubramanian, linux-doc, linux-arm-msm, devicetree,
linux-i2c, linux-serial, Jiri Slaby, evgreen, acourbot,
Girish Mahadevan, swboyd
In-Reply-To: <03c5ed5b-5160-bdd5-82f9-4a8beab33ca8@codeaurora.org>
Hi,
On Wed, Mar 7, 2018 at 6:42 PM, Sagar Dharia <sdharia@codeaurora.org> wrote:
> Hi Doug,
> Thank you for reviewing the patch. I will take a stab at a few comments
> below. We will address most of the other comments in next version of I2C
> patch.
>>
>>
>>
>>> +
>>> +#define I2C_AUTO_SUSPEND_DELAY 250
>>
>>
>> Why 250 ms? That seems like an eternity. Is it really that expensive
>> to turn resources off and on? I would sorta just expect clocks and
>> stuff to get turned off right after a transaction finished unless
>> another one was pending right behind it...
>>
> The response from RPMh to turn on/off shared resources also take quite a few
> msecs. The QUP serial bus block sits quite a few shared-NOCs away from the
> memory and runtime-PM is used a bandwidth vote/NOC vote for these NOCs from
> QUP to memory. Also the RPC between apps and RPMh can sometimes take longer
> depending on other tasks running on apps. This 250 msec avoids thrashing of
> these RPCs between apps and RPMh.
> If you plan to keep these NOCs on forever, then your are right: runtime-PM
> will be only used to turn on/off local clocks and we won't even need
> autosuspend. that's not true on products where this driver is currently
> deployed.
OK, fair enough. I don't know how RPMh works well enough to argue.
It does seem odd that you'd want to design things such that it takes a
few msecs to pull it out of runtime suspend, especially for touch.
>>> +
>>> +static const struct geni_i2c_clk_fld geni_i2c_clk_map[] = {
>>> + {KHz(100), 7, 10, 11, 26},
>>> + {KHz(400), 2, 5, 12, 24},
>>> + {KHz(1000), 1, 3, 9, 18},
>>
>>
>> So I guess this is all relying on an input serial clock of 19.2MHz?
>> Maybe document that?
>>
>> Assuming I'm understanding the math here, is it really OK for your
>> 100kHz and 1MHz mode to be running slightly fast?
>>
>> 19200. / 2 / 24
>>>>>
>>>>> 400.0
>>
>>
>> 19200. / 7 / 26
>>>>>
>>>>> 105.49450549450549
>>
>>
>> 19200. / 1 / 18
>>>>>
>>>>> 1066.6666666666667
>>
>>
>> It seems like you'd want the fastest clock that you can make that's
>> _less than_ the spec.
>>
>>
>> It would also be interesting to know if it's expected that boards
>> might need to tweak the t_high / t_low depending on their electrical
>> characteristics. In the past I've had lots of requests from board
>> makers to tweak things because they've got a long trace, or a stronger
>> or weaker pull, or ... If so we might later need to add some dts
>> properties like "i2c-scl-rising-time-ns" and make the math more
>> dynamic here, unless your hardware somehow automatically adjusts for
>> this type of thing...
>> These values are derived by our HW team to comply with the t-high and
>
> t-low specs of I2C. We have confirmed on scope that the frequency of SCL is
> indeed less than/equal to the spec. We have not come across slaves who have
> needed to tweak these things. We are open to adding these properties in dts
> if you have any such slaves not conforming due to board-layout of other
> reasons.
OK, I'm fine with leaving something like this till later if/when it
comes up. Documenting a little bit more about how these timings work
seems like it would be nice, though, at least mentioning what the
source clock is...
>>>
>>> + mode = msg->len > 32 ? GENI_SE_DMA : GENI_SE_FIFO;
>>
>>
>> DMA is hard and i2c transfers > 32 bytes are rare. Do we really gain
>> a lot by transferring i2c commands over DMA compared to a FIFO?
>> Enough to justify the code complexity and the set of bugs that will
>> show up? I'm sure it will be a controversial assertion given that the
>> code's already written, but personally I'd be supportive of ripping
>> DMA mode out to simplify the driver. I'd be curious if anyone else
>> agrees. To me it seems like premature optimization.
>
>
> Yes, we have multiple clients (e.g. touch, NFC) using I2C for data transfers
> bigger than 32 bytes (some transfers are 100s of bytes). The fifo size is
> 32, so we can definitely avoid at least 1 interrupt when DMA mode is used
> with data size > 32.
Does that 1-2 interrupts make any real difference, though? In theory
it really shouldn't affect the transfer rate. We should be able to
service the interrupt plenty fast and if we were concerned we would
tweak the watermark code a little bit. So I guess we're worried about
the extra CPU cycles (and power cost) to service those extra couple
interrupts?
In theory when touch data is coming in or NFC data is coming in then
we're probably not in a super low power state to begin with. If it's
touch data we likely want to have the CPU boosted a bunch to respond
to the user quickly. If we've got 8 cores available all of which can
run at 1GHz or more a few interrupts won't kill us. NFC data is
probably not common enough that we need to optimize power/CPU
utilizatoin for that.
So while i can believe that you do save an interrupt or two, I still
am not convinced that those interrupts are worth a bunch of complex
code (and a whole second code path) to save.
...also note that above you said that coming out of runtime suspend
can take several msec. That seems like it dwarfs any slight
difference in timing between a FIFO-based operation and DMA.
>>> + geni_se_select_mode(&gi2c->se, mode);
>>> + writel_relaxed(msg->len, gi2c->se.base + SE_I2C_RX_TRANS_LEN);
>>> + geni_se_setup_m_cmd(&gi2c->se, I2C_READ, m_param);
>>> + if (mode == GENI_SE_DMA) {
>>> + rx_dma = geni_se_rx_dma_prep(&gi2c->se, msg->buf,
>>> msg->len);
>>
>>
>> Randomly I noticed a flag called "I2C_M_DMA_SAFE". Do we need to
>> check this flag before using msg->buf for DMA? ...or use
>> i2c_get_dma_safe_msg_buf()?
>>
>> ...btw: the relative lack of people doing this in the kernel is
>> further evidence of DMA not really being worth it for i2c busses.
>
> I cannot comment about other drivers here using or not using DMA since they
> may not be exercised with slaves like NFC?
>>>
>>> + ret = pm_runtime_get_sync(gi2c->se.dev);
>>> + if (ret < 0) {
>>> + dev_err(gi2c->se.dev, "error turning SE resources:%d\n",
>>> ret);
>>> + pm_runtime_put_noidle(gi2c->se.dev);
>>> + /* Set device in suspended since resume failed */
>>> + pm_runtime_set_suspended(gi2c->se.dev);
>>> + return ret;
>>
>>
>> Wow, that's a cluster of arcane calls to handle a call that probably
>> will never fail (it just enables clocks and sets pinctrl). Sigh.
>> ...but as far as I can tell the whole sequence is right. You
>> definitely need a "put" after a failed get and it looks like
>> pm_runtime_set_suspended() has a special exception where it can be
>> called if you got a runtime error...
>
> We didn't have this in before either. But this condition is somewhat
> frequent if I2C transactions are called on cusp of exiting system suspend.
> (e.g. PMIC slave getting a wakeup-IRQ and trying to read from PMIC through
> I2C to read its status as to what caused that wake-up. At that time,
> get_sync doesn't really enable resources (kernel 4.9) since the runtime-pm
> ref-count isn't decremented. We run the risk of unclocked access if these
> arcane calls aren't present. You can go through runtime-pm documentation
> chapter 6 for more details.
Yeah, I certainly agree that the calls are needed if
pm_runtime_get_sync() and I'm not suggesting removing them. Hence the
"as far as I can tell the whole sequence is right".
...but I'm actually kinda worried if you're saying that you actually
ran into this case. Hopefully that got fixed and code no longer tries
to read from the PMIC at a bad time anymore? That code should be
fixed not to be running so late in suspend.
>>> + ret = devm_request_irq(&pdev->dev, gi2c->irq, geni_i2c_irq,
>>> + IRQF_TRIGGER_HIGH, "i2c_geni", gi2c);
>>> + if (ret) {
>>> + dev_err(&pdev->dev, "Request_irq failed:%d: err:%d\n",
>>> + gi2c->irq, ret);
>>> + return ret;
>>> + }
>>> + disable_irq(gi2c->irq);
>>
>>
>> Can you explain the goal of the disable_irq() here. Is it actually
>> needed for something or does it somehow save power? From drivers I've
>> reviewed in the past this doesn't seem like a common thing to do, so
>> I'm curious what it's supposed to gain for you. I'd be inclined to
>> just delete the whole disable/enable of the irq from this driver.
>
>
> Qualcomm's power team suggests we enable/disable unused IRQs. Otherwise they
> can block apps from entering some low-power mode (unless the interrupt is in
> some list?) I will confirm again with them and let you know.
Since this is weird (to me anyway), please document w/ a comment.
>>>
>>> + /* Make sure no transactions are pending */
>>> + ret = i2c_trylock_bus(&gi2c->adap, I2C_LOCK_SEGMENT);
>>> + if (!ret) {
>>> + dev_err(gi2c->se.dev, "late I2C transaction request\n");
>>> + return -EBUSY;
>>> + }
>>
>>
>> Does this happen? How?
>>
>> Nothing about this code looks special for your hardware. If this is
>> really needed, why is it not part of the i2c core since there's
>> nothing specific about your driver here?
>>
> There have been some clients that don't implement sys-suspend/resume
> callbacks (so i2c adapter has no clue they are done with their transactions)
> and this allows us to be flexible when they call I2C transactions extremely
> late.
Still feels like this belongs in the i2c core, not your driver. Maybe
you should send a patch for the core and remove it from here?
...and also, it seems like any i2c clients that don't implement the
suspend/resume callbacks and try to do i2c transactions late in the
game need to be fixed. It should be documented that this isn't a
valid thing for a driver to do and if we end up in this error case
then it's not an i2c issue but it's a bad driver somewhere.
>
>>
>>> + if (!pm_runtime_status_suspended(device)) {
>>> + geni_i2c_runtime_suspend(device);
>>> + pm_runtime_disable(device);
>>> + pm_runtime_set_suspended(device);
>>> + pm_runtime_enable(device);
>>> + }
>>
>>
>> Similar question. Why do you need this special case code? Are there
>> cases where we're all the way at suspend_noirq and yet we still
>> haven't runtime suspended? Can you please document how we get into
>> this state?
>> This is when transaction happens less-than 250 msec of the
>
> system-suspend. PM-runtime has not gotten a chance to auto-suspend us since
> timer hasn't expired before system-suspend is attempted. These calls make
> sure that we truly turn off driver resources and make runtime-PM state
> consistent with the HW state. We can document this.
OK. PM Runtime always gets me mixed up. Seems really strange that it
wouldn't autosuspend all devices (regardless of timeout) at system
suspend time.
-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 05/10] hwmon: generic-pwm-tachometer: Add generic PWM based tachometer
From: Laxman Dewangan @ 2018-03-08 6:06 UTC (permalink / raw)
To: Guenter Roeck, Rajkumar Rampelli, Mikko Perttunen, robh+dt,
mark.rutland, thierry.reding, jonathanh, jdelvare, corbet,
catalin.marinas, will.deacon, kstewart, gregkh, pombredanne,
mmaddireddy, mperttunen, arnd, timur, andy.gross, xuwei5, elder,
heiko, krzk, ard.biesheuvel
Cc: devicetree, linux-kernel, linux-pwm, linux-tegra, linux-hwmon,
linux-doc, linux-arm-kernel
In-Reply-To: <f7818e4c-17b6-c58b-3424-85749bb9c1cc@roeck-us.net>
On Wednesday 07 March 2018 07:50 PM, Guenter Roeck wrote:
> On 03/07/2018 01:47 AM, Rajkumar Rampelli wrote:
>>
>>>
>>> While I am not opposed to ABI changes, the merits of those would
>>> need to be
>>> discussed on the mailing list. But replacing "fan1_input" with "rpm" is
>>> not an acceptable ABI change, even if it may measure something that
>>> turns
>>> but isn't a fan.
>>>
>>> If this _is_ in fact supposed to be used for something else but
>>> fans, we
>>> would have to discuss what that might be, and if hwmon is the
>>> appropriate
>>> subsystem to measure and report it. This does to some degree lead
>>> back to
>>> my concern of having the "fan" part of this patch series in the pwm
>>> core.
>>> I am still not sure if that makes sense.
>>>
>>> Thanks,
>>> Guenter
>> I am planning to add tachometer support in pwm-fan.c driver
>> (drivers/hwmon/) instead of adding new generic-pwm-tachometer.c
>> driver. Measuring RPM value will be done in pwm-fan driver itself
>> using pwm capture feature and will add new sysfs attributes under
>> this driver to report rpm value of fan.
>
> There is an existing attribute to report the RPM of fans. It is called
> fan[1..n]_input.
>
> "replacing "fan1_input" with "rpm" is not an acceptable ABI change"
>
> Preemptive NACK.
The RPM is measured speed via PWM signal capture which is output from fan.
So should we have the fan[1..n]_output_rpm?
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 4/4] tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP
From: Karthik Ramasubramanian @ 2018-03-08 6:06 UTC (permalink / raw)
To: Stephen Boyd, andy.gross, corbet, david.brown, gregkh,
mark.rutland, robh+dt, wsa
Cc: linux-doc, linux-arm-msm, devicetree, linux-i2c, linux-serial,
jslaby, evgreen, acourbot, Girish Mahadevan, Sagar Dharia,
Doug Anderson
In-Reply-To: <152037270430.218381.11080419743809466427@swboyd.mtv.corp.google.com>
On 3/6/2018 2:45 PM, Stephen Boyd wrote:
> Quoting Karthik Ramasubramanian (2018-03-05 16:51:23)
>> On 3/2/2018 3:11 PM, Stephen Boyd wrote:
>>> Quoting Karthikeyan Ramasubramanian (2018-02-27 17:38:09)
>>>
>>>> + size_t chars_to_write = 0;
>>>> + size_t avail = DEF_FIFO_DEPTH_WORDS - DEF_TX_WM;
>>>> +
>>>> + /*
>>>> + * If the WM bit never set, then the Tx state machine is not
>>>> + * in a valid state, so break, cancel/abort any existing
>>>> + * command. Unfortunately the current data being written is
>>>> + * lost.
>>>> + */
>>>> + while (!qcom_geni_serial_poll_bit(uport, SE_GENI_M_IRQ_STATUS,
>>>> + M_TX_FIFO_WATERMARK_EN, true))
>>>
>>> Does this ever timeout? So many nested while loops makes it hard to
>>> follow.
>> Yes. Based on the baud rate of 115200 and the FIFO Depth & Width of (16
>> * 32), the poll should not take more than 5 ms under the timeout scenario.
>
> Sure, but I'm asking if this has any sort of timeout associated with it.
> It looks to be a while loop that could possibly go forever?
I will change it from a while loop to if condition to make it clear.
>
>>>> +static void qcom_geni_serial_console_write(struct console *co, const char *s,
>>>> + unsigned int count)
>>>> +{
>>>> + struct uart_port *uport;
>>>> + struct qcom_geni_serial_port *port;
>>>> + bool locked = true;
>>>> + unsigned long flags;
>>>> +
>>>> + WARN_ON(co->index < 0 || co->index >= GENI_UART_CONS_PORTS);
>>>> +
>>>> + port = get_port_from_line(co->index);
>>>> + if (IS_ERR(port))
>>>> + return;
>>>> +
>>>> + uport = &port->uport;
>>>> + if (oops_in_progress)
>>>> + locked = spin_trylock_irqsave(&uport->lock, flags);
>>>> + else
>>>> + spin_lock_irqsave(&uport->lock, flags);
>>>> +
>>>> + if (locked) {
>>>> + __qcom_geni_serial_console_write(uport, s, count);
>>>
>>> So if oops is in progress, and we didn't lock here, we don't output
>>> data? I'd think we would always want to write to the fifo, just make the
>>> lock grab/release conditional.
>> If we fail to grab the lock, then there is another active writer. So
>> trying to write to the fifo will put the hardware in bad state because
>> writer has programmed the hardware to write 'x' number of words and this
>> thread will over-write it with 'y' number of words. Also the data that
>> you might see in the console might be garbled.
>
> I suspect that because this is the serial console, and we want it to
> always output stuff even when we're going down in flames, we may want to
> ignore that case and just wait for the fifo to free up and then
> overwrite the number of words that we want to output and push out more
> characters.
>
> I always get confused though because there seem to be lots of different
> ways to do things in serial drivers and not too much clear documentation
> that I've read describing what to do.
Ok. If the active writer is interrupted due to OOPS handler, then the
interrupted write can be cancelled and the write from OOPS handler can
be performed.
>
>>>
>>>> + spin_unlock_irqrestore(&uport->lock, flags);
>>>> + }
>>>> +}
> [...]
>>>> +
>>>> + if (m_irq_status & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN) &&
>>>> + m_irq_en & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN))
>>>> + qcom_geni_serial_handle_tx(uport);
>>>> +
>>>> + if (s_irq_status & S_GP_IRQ_0_EN || s_irq_status & S_GP_IRQ_1_EN) {
>>>> + if (s_irq_status & S_GP_IRQ_0_EN)
>>>> + uport->icount.parity++;
>>>> + drop_rx = true;
>>>> + } else if (s_irq_status & S_GP_IRQ_2_EN ||
>>>> + s_irq_status & S_GP_IRQ_3_EN) {
>>>> + uport->icount.brk++;
>>>
>>> How does break character handling work? I see the accounting here, but
>>> don't see any uart_handle_break() call anywhere.
>> The reason it is not added is because the hardware does not indicate
>> when the break character occured. It can be any one of the FIFO words.
>> The statistics is updated to give an idea that the break happened. We
>> can add uart_handle_break() but it may not be at an accurate position
>> for the above mentioned reason.
>
> Sounds like the previous uart design. We would want uart_handle_break()
> support for kgdb to work over serial. Do we still get an interrupt
> signal that a break character is somewhere in the fifo? If we get that,
> then does it also put a NUL (0) character into the fifo that we can
> find? I had to do something like that before, where we detect the irq
> and then we go through the fifo a character at a time to find the break
> character that looks like a NUL, and then let sysrq core handle the
> characters after that break character comes in.
I will use the same logic as in blsp2 serial to catch the break
character, same as NULL and push the break character to the framework.
>
>>>
>>>
>>>> +}
>>>> +
>>>> +static unsigned long get_clk_div_rate(unsigned int baud, unsigned int *clk_div)
>>>> +{
>>>> + unsigned long ser_clk;
>>>> + unsigned long desired_clk;
>>>> +
>>>> + desired_clk = baud * UART_OVERSAMPLING;
>>>> + ser_clk = get_clk_cfg(desired_clk);
>>>> + if (!ser_clk) {
>>>> + pr_err("%s: Can't find matching DFS entry for baud %d\n",
>>>> + __func__, baud);
>>>> + return ser_clk;
>>>> + }
>>>> +
>>>> + *clk_div = ser_clk / desired_clk;
>>>
>>> How wide can clk_div be? It may be better to implement the ser_clk as an
>>> actual clk in the common clk framework, and then have the serial driver
>>> or the i2c driver call clk_set_rate() on that clk and have the CCF
>>> implementation take care of determining the rate that the parent clk can
>>> supply and how it can fit it into the frequency that the divider can
>>> support.
>> Based on my current expertise with the CCF, I will address this comment
>> in a later patchset than the next one.
>
> Ok. I've seen similar designs in some mmc drivers. For example, you can
> look at drivers/mmc/host/meson-gx-mmc.c and see that they register a
> clk_ops and then just start using that clk directly from the driver.
> There are also some helper functions for dividers that would hopefully
> make the job of calculating the best divider easier.
Thanks for the pointers. I will take a look at it. In the meanwhile I
had discussions with our clock team. They pointed out that the register
to write the divider value here is outside the scope of clock controller
which makes it trickier to implement your suggestion. They are already
in the mailing list and we will discuss further and get back to you in
this regard.
>
>>>> +
>>>> + uport->uartclk = clk_rate;
>>>> + clk_set_rate(port->se.clk, clk_rate);
>>>> + ser_clk_cfg = SER_CLK_EN;
>>>> + ser_clk_cfg |= (clk_div << CLK_DIV_SHFT);
>>>
>>> Drop useless cast.
>> I think you mean parenthesis. I do not see casting here.
>
> Yes! You got it.
>
>>>> +#endif
>>>> + .pm = qcom_geni_serial_cons_pm,
>>>> +};
>>>> +
>>>> +static int qcom_geni_serial_probe(struct platform_device *pdev)
>>>> +{
>>>> + int ret = 0;
>>>> + int line = -1;
>>>> + struct qcom_geni_serial_port *port;
>>>> + struct uart_port *uport;
>>>> + struct resource *res;
>>>> + struct uart_driver *drv;
>>>> +
>>>> + drv = (void *)of_device_get_match_data(&pdev->dev);
>>>
>>> Useless cast.
>> There were compiler warnings assigning a const void * to a void *. That
>> is why I have the cast in place.
>
> Oh. Yes you shouldn't cast away the const. Please make the compiler
> warning go away without casting it away.
Ok. I will figure out an alternative to this one.
>
>>>
>>>
>>> Also, I see some serial drivers do the mapping when the port is
>>> requested. That can't be done here?
>> By "when the port is requested" do you mean console's setup operation.
>> It can be done, but given that it is a one-time operation I am not sure
>> if it makes any difference between mapping here and there.
>
> No. I meant the uart_ops::uart_request() function and also
> uart_ops::config_port(). Take a look at msm_config_port() and
> msm_request_port() for how it was done on pre-geni qcom uarts.
>
I will take a look at it and update accordingly.
> I suppose we should try to probe this as a module and run a getty on it
> and then remove and probe the module a couple times after that.
> That should shake out some bugs.
>
>>>> +
>>>> +static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
>>>> + .suspend_noirq = qcom_geni_serial_sys_suspend_noirq,
>>>> + .resume_noirq = qcom_geni_serial_sys_resume_noirq,
>>>
>>> Why are these noirq variants? Please add a comment.
>> The intention is to enable the console UART port usage as late as
>> possible in the suspend cycle. Hence noirq variants. I will add this as
>> a comment. Please let me know if the usage does not match the intention.
>
> Hm.. Does no_console_suspend not work? Or not work well enough?
It works. When console suspend is disabled, the suspend operation does
not get triggered and the resume operation checks if the console suspend
is disabled and performs the needed thing.
>
Regards,
Karthik.
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v9 5/7] arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl
From: gengdongjiu @ 2018-03-08 6:18 UTC (permalink / raw)
To: James Morse, drjones
Cc: gengdongjiu, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, corbet@lwn.net,
marc.zyngier@arm.com, catalin.marinas@arm.com,
linux-doc@vger.kernel.org, rjw@rjwysocki.net,
linux@armlinux.org.uk, will.deacon@arm.com,
robert.moore@intel.com, linux-acpi@vger.kernel.org, bp@alien8.de,
lv.zheng@intel.com, Huangshaoyu, kvmarm@lists.cs.columbia.edu,
devel@acpica.org
In-Reply-To: <5A85C974.70500@arm.com>
Hi James,
sorry for my late response due to chines new year.
2018-02-16 1:55 GMT+08:00 James Morse <james.morse@arm.com>:
> Hi gengdongjiu,
>
> On 12/02/18 10:19, gengdongjiu wrote:
>> On 2018/2/10 1:44, James Morse wrote:
>>> The point? We can't know what a CPU without the RAS extensions puts in there.
>>>
>>> Why Does this matter? When migrating a pending SError we have to know the
>>> difference between 'use this 64bit value', and 'the CPU will generate it'.
>>> If I make an SError pending with ESR=0 on a CPU with VSESR, I can't migrated to
>>> a system that generates an impdef SError-ESR, because I can't know it will be 0.
>
>> For the target system, before taking the SError, no one can know whether its syndrome value
>> is IMPLEMENTATION DEFINED or architecturally defined.
>
> For a virtual-SError, the hypervisor knows what it generated. (do I have
> VSESR_EL2? What did I put in there?).
>
>
>> when the virtual SError is taken, the ESR_ELx.IDS will be updated, then we can know
>> whether the ESR value is impdef or architecturally defined.
>
> True, the guest can't know anything about a pending virtual SError until it
> takes it. Why is this a problem?
>
>
>> It seems migration is only allowed only when target system and source system all support
>> RAS extension, because we do not know whether its syndrome is IMPLEMENTATION DEFINED or
>> architecturally defined.
>
> I don't think Qemu allows migration between hosts with differing guest-ID
> registers. But we shouldn't depend on this, and we may want to hide the v8.2 RAS
> features from the guest's ID register, but still use them from the host.
>
> The way I imagined it working was we would pack the following information into
> that events struct:
> {
> bool serror_pending;
> bool serror_has_esr;
> u64 serror_esr;
> }
I have used your suggestion struct
>
> The problem I was trying to describe is because there is no value of serror_esr
> we can use to mean 'Ignore this, I'm a v8.0 CPU'. VSESR_EL2 is a 64bit register,
> any bits we abuse may get a meaning we want to use in the future.
>
> When it comes to migration, v8.{0,1} systems can only GET/SET events where
> serror_has_esr == false, they can't use the serror_esr. On v8.2 systems we
> should require serror_has_esr to be true.
yes, I agreed.
>
> If we need to support migration from v8.{0,1} to v8.2, we can make up an impdef
> serror_esr.
For the Qemu migration, I need to check more the QEMU code.
Hi Andrew,
I use KVM_GET/SET_VCPU_EVENTS IOCTL to migrate the Serror
exception status of VM,
The even struct is shown below:
{
bool serror_pending;
bool serror_has_esr;
u64 serror_esr;
}
Only when the target machine is armv8.2, it needs to set the
serror_esr(SError Exception Syndrome Register).
for the armv8.0, software can not set the serror_esr(SError Exception
Syndrome Register).
so when migration from v8.{0,1} to v8.2, QEMU should make up an impdef
serror_esr for the v8.2 target.
can you give me some suggestion how to set that register in the QEMU?
I do not familar with the QEMU migration.
Thanks very much.
>
> We will need to decide what KVM does when SET is called but an SError was
> already pending. 2.5.3 "Multiple SError interrupts" of [0] has something to say.
how about KVM set again to the same VCPU?
>
>
> Happy new year,
thanks!
>
> James
>
>
> [0]
> https://static.docs.arm.com/ddi0587/a/RAS%20Extension-release%20candidate_march_29.pdf
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 2/4] soc: qcom: Add GENI based QUP Wrapper driver
From: Karthik Ramasubramanian @ 2018-03-08 6:46 UTC (permalink / raw)
To: Stephen Boyd, Stephen Boyd, andy.gross, corbet, david.brown,
gregkh, mark.rutland, robh+dt, wsa, hch, m.szyprowski,
robin.murphy
Cc: linux-doc, linux-arm-msm, devicetree, linux-i2c, linux-serial,
jslaby, evgreen, acourbot, Sagar Dharia, Girish Mahadevan, iommu
In-Reply-To: <152037339742.218381.11498404122038956963@swboyd.mtv.corp.google.com>
On 3/6/2018 2:56 PM, Stephen Boyd wrote:
> Quoting Karthik Ramasubramanian (2018-03-02 16:58:23)
>
>>>> + return iova;
>>>> +}
>>>> +EXPORT_SYMBOL(geni_se_tx_dma_prep);
>>>> +
>>>> +/**
>>>> + * geni_se_rx_dma_prep() - Prepare the Serial Engine for RX DMA transfer
>>>> + * @se: Pointer to the concerned Serial Engine.
>>>> + * @buf: Pointer to the RX buffer.
>>>> + * @len: Length of the RX buffer.
>>>> + *
>>>> + * This function is used to prepare the buffers for DMA RX.
>>>> + *
>>>> + * Return: Mapped DMA Address of the buffer on success, NULL on failure.
>>>> + */
>>>> +dma_addr_t geni_se_rx_dma_prep(struct geni_se *se, void *buf, size_t len)
>>>> +{
>>>> + dma_addr_t iova;
>>>> + struct geni_wrapper *wrapper = se->wrapper;
>>>> + u32 val;
>>>> +
>>>> + iova = dma_map_single(wrapper->dev, buf, len, DMA_FROM_DEVICE);
>>>> + if (dma_mapping_error(wrapper->dev, iova))
>>>> + return (dma_addr_t)NULL;
>>>
>>> Can't return a dma_mapping_error address to the caller and have them
>>> figure it out?
>> Earlier we used to return the DMA_ERROR_CODE which has been removed
>> recently in arm64 architecture. If we return the dma_mapping_error, then
>> the caller also needs the device which encountered the mapping error.
>> The serial interface drivers can use their parent currently to resolve
>> the mapping error. Once the wrapper starts mapping using IOMMU context
>> bank, then the serial interface drivers do not know which device to use
>> to know if there is an error.
>>
>> Having said that, the dma_ops suggestion might help with handling this
>> situation. I will look into it further.
>
> Ok, thanks.
>
>>>> +{
>>>> + struct geni_wrapper *wrapper = se->wrapper;
>>>> +
>>>> + if (iova)
>>>> + dma_unmap_single(wrapper->dev, iova, len, DMA_FROM_DEVICE);
>>>> +}
>>>> +EXPORT_SYMBOL(geni_se_rx_dma_unprep);
>>>
>>> Instead of having the functions exported, could we set the dma_ops on
>>> all child devices of the wrapper that this driver populates and then
>>> implement the DMA ops for those devices here? I assume that there's
>>> never another DMA master between the wrapper and the serial engine, so I
>>> think it would work.
>> This suggestion looks like it will work.
>
> It would be a good idea to check with some other people on the dma_ops
> suggestion. Maybe add the DMA mapping subsystem folks to help out here
I have added the DMA mapping subsystem folks to help out here.
To present an overview, we have a wrapper controller which is composed
of several serial engines. The serial engines are programmed with UART,
I2C or SPI protocol and support DMA transfer. When the serial engines
perform DMA transfer, the wrapper controller device is used to perform
the mapping. The reason wrapper device is used is because of IOMMU and
there is only one IOMMU context bank to perform the translation for the
entire wrapper controller. So the wrapper controller exports map and
unmap functions to the individual protocol drivers.
There is a suggestion to make the parent wrapper controller implement
the dma_map_ops, instead of exported map/unmap functions and populate
those dma_map_ops on all the children serial engines. Can you please
provide your inputs regarding this suggestion?
>
> DMA MAPPING HELPERS
> M: Christoph Hellwig <hch@lst.de>
> M: Marek Szyprowski <m.szyprowski@samsung.com>
> R: Robin Murphy <robin.murphy@arm.com>
> L: iommu@lists.linux-foundation.org
>
>
Regards,
Karthik.
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 05/10] hwmon: generic-pwm-tachometer: Add generic PWM based tachometer
From: Mikko Perttunen @ 2018-03-08 7:57 UTC (permalink / raw)
To: Guenter Roeck, Rajkumar Rampelli, Mikko Perttunen, robh+dt,
mark.rutland, thierry.reding, jonathanh, jdelvare, corbet,
catalin.marinas, will.deacon, kstewart, gregkh, pombredanne,
mmaddireddy, arnd, timur, andy.gross, xuwei5, elder, heiko, krzk,
ard.biesheuvel
Cc: devicetree, linux-kernel, linux-pwm, linux-tegra, linux-hwmon,
linux-doc, linux-arm-kernel, ldewangan
In-Reply-To: <f7818e4c-17b6-c58b-3424-85749bb9c1cc@roeck-us.net>
On 07.03.2018 16:20, Guenter Roeck wrote:
> On 03/07/2018 01:47 AM, Rajkumar Rampelli wrote:
>>
>>
>> On Wednesday 28 February 2018 07:59 PM, Guenter Roeck wrote:
>>> On 02/27/2018 11:03 PM, Mikko Perttunen wrote:
>>>> On 02/28/2018 08:12 AM, Rajkumar Rampelli wrote:
>>>>>
>>>>> On Wednesday 28 February 2018 11:28 AM, Guenter Roeck wrote:
>>>>>> On 02/27/2018 09:38 PM, Rajkumar Rampelli wrote:
>>>>>>>
>>>>>>> On Wednesday 21 February 2018 08:20 PM, Guenter Roeck wrote:
>>>>>>>> On 02/20/2018 10:58 PM, Rajkumar Rampelli wrote:
>>>>>>>>> Add generic PWM based tachometer driver via HWMON interface
>>>>>>>>> to report the RPM of motor. This drivers get the period/duty
>>>>>>>>> cycle from PWM IP which captures the motor PWM output.
>>>>>>>>>
>>>>>>>>> This driver implements a simple interface for monitoring the
>>>>>>>>> speed of
>>>>>>>>> a fan and exposes it in roatations per minute (RPM) to the user
>>>>>>>>> space
>>>>>>>>> by using the hwmon's sysfs interface
>>>>>>>>>
>>>>>>>>> Signed-off-by: Rajkumar Rampelli <rrajk@nvidia.com>
>>>>>>>>> ---
>>>>>>>>> Documentation/hwmon/generic-pwm-tachometer | 17 +++++
>>>>>>>>> drivers/hwmon/Kconfig | 10 +++
>>>>>>>>> drivers/hwmon/Makefile | 1 +
>>>>>>>>> drivers/hwmon/generic-pwm-tachometer.c | 112
>>>>>>>>> +++++++++++++++++++++++++++++
>>>>>>>>> 4 files changed, 140 insertions(+)
>>>>>>>>> create mode 100644 Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>> create mode 100644 drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>>
>>>>>>>>> diff --git a/Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>> b/Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>> new file mode 100644
>>>>>>>>> index 0000000..e0713ee
>>>>>>>>> --- /dev/null
>>>>>>>>> +++ b/Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>> @@ -0,0 +1,17 @@
>>>>>>>>> +Kernel driver generic-pwm-tachometer
>>>>>>>>> +====================================
>>>>>>>>> +
>>>>>>>>> +This driver enables the use of a PWM module to monitor a fan.
>>>>>>>>> It uses the
>>>>>>>>> +generic PWM interface and can be used on SoCs as along as the
>>>>>>>>> SoC supports
>>>>>>>>> +Tachometer controller that moniors the Fan speed in periods.
>>>>>>>>> +
>>>>>>>>> +Author: Rajkumar Rampelli <rrajk@nvidia.com>
>>>>>>>>> +
>>>>>>>>> +Description
>>>>>>>>> +-----------
>>>>>>>>> +
>>>>>>>>> +The driver implements a simple interface for monitoring the
>>>>>>>>> Fan speed using
>>>>>>>>> +PWM module and Tachometer controller. It requests period value
>>>>>>>>> through PWM
>>>>>>>>> +capture interface to Tachometer and measures the Rotations per
>>>>>>>>> minute using
>>>>>>>>> +received period value. It exposes the Fan speed in RPM to the
>>>>>>>>> user space by
>>>>>>>>> +using the hwmon's sysfs interface.
>>>>>>>>> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
>>>>>>>>> index ef23553..8912dcb 100644
>>>>>>>>> --- a/drivers/hwmon/Kconfig
>>>>>>>>> +++ b/drivers/hwmon/Kconfig
>>>>>>>>> @@ -1878,6 +1878,16 @@ config SENSORS_XGENE
>>>>>>>>> If you say yes here you get support for the temperature
>>>>>>>>> and power sensors for APM X-Gene SoC.
>>>>>>>>> +config GENERIC_PWM_TACHOMETER
>>>>>>>>> + tristate "Generic PWM based tachometer driver"
>>>>>>>>> + depends on PWM
>>>>>>>>> + help
>>>>>>>>> + Enables a driver to use PWM signal from motor to use
>>>>>>>>> + for measuring the motor speed. The RPM is captured by
>>>>>>>>> + PWM modules which has PWM capture capability and this
>>>>>>>>> + drivers reads the captured data from PWM IP to convert
>>>>>>>>> + it to speed in RPM.
>>>>>>>>> +
>>>>>>>>> if ACPI
>>>>>>>>> comment "ACPI drivers"
>>>>>>>>> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
>>>>>>>>> index f814b4a..9dcc374 100644
>>>>>>>>> --- a/drivers/hwmon/Makefile
>>>>>>>>> +++ b/drivers/hwmon/Makefile
>>>>>>>>> @@ -175,6 +175,7 @@ obj-$(CONFIG_SENSORS_WM8350) +=
>>>>>>>>> wm8350-hwmon.o
>>>>>>>>> obj-$(CONFIG_SENSORS_XGENE) += xgene-hwmon.o
>>>>>>>>> obj-$(CONFIG_PMBUS) += pmbus/
>>>>>>>>> +obj-$(CONFIG_GENERIC_PWM_TACHOMETER) += generic-pwm-tachometer.o
>>>>>>>>> ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
>>>>>>>>> diff --git a/drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>> b/drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>> new file mode 100644
>>>>>>>>> index 0000000..9354d43
>>>>>>>>> --- /dev/null
>>>>>>>>> +++ b/drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>> @@ -0,0 +1,112 @@
>>>>>>>>> +/*
>>>>>>>>> + * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights
>>>>>>>>> reserved.
>>>>>>>>> + *
>>>>>>>>> + * This program is free software; you can redistribute it
>>>>>>>>> and/or modify it
>>>>>>>>> + * under the terms and conditions of the GNU General Public
>>>>>>>>> License,
>>>>>>>>> + * version 2, as published by the Free Software Foundation.
>>>>>>>>> + *
>>>>>>>>> + * This program is distributed in the hope it will be useful,
>>>>>>>>> but WITHOUT
>>>>>>>>> + * ANY WARRANTY; without even the implied warranty of
>>>>>>>>> MERCHANTABILITY or
>>>>>>>>> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
>>>>>>>>> Public License for
>>>>>>>>> + * more details.
>>>>>>>>> + *
>>>>>>>>> + */
>>>>>>>>> +
>>>>>>>>> +#include <linux/module.h>
>>>>>>>>> +#include <linux/platform_device.h>
>>>>>>>>> +#include <linux/err.h>
>>>>>>>>> +#include <linux/pwm.h>
>>>>>>>>> +#include <linux/hwmon.h>
>>>>>>>>> +#include <linux/hwmon-sysfs.h>
>>>>>>>>> +
>>>>>>>>> +struct pwm_hwmon_tach {
>>>>>>>>> + struct device *dev;
>>>>>>>>> + struct pwm_device *pwm;
>>>>>>>>> + struct device *hwmon;
>>>>>>>>> +};
>>>>>>>>> +
>>>>>>>>> +static ssize_t show_rpm(struct device *dev, struct
>>>>>>>>> device_attribute *attr,
>>>>>>>>> + char *buf)
>>>>>>>>> +{
>>>>>>>>> + struct pwm_hwmon_tach *ptt = dev_get_drvdata(dev);
>>>>>>>>> + struct pwm_device *pwm = ptt->pwm;
>>>>>>>>> + struct pwm_capture result;
>>>>>>>>> + int err;
>>>>>>>>> + unsigned int rpm = 0;
>>>>>>>>> +
>>>>>>>>> + err = pwm_capture(pwm, &result, 0);
>>>>>>>>> + if (err < 0) {
>>>>>>>>> + dev_err(ptt->dev, "Failed to capture PWM: %d\n", err);
>>>>>>>>> + return err;
>>>>>>>>> + }
>>>>>>>>> +
>>>>>>>>> + if (result.period)
>>>>>>>>> + rpm = DIV_ROUND_CLOSEST_ULL(60ULL * NSEC_PER_SEC,
>>>>>>>>> + result.period);
>>>>>>>>> +
>>>>>>>>> + return sprintf(buf, "%u\n", rpm);
>>>>>>>>> +}
>>>>>>>>> +
>>>>>>>>> +static SENSOR_DEVICE_ATTR(rpm, 0444, show_rpm, NULL, 0);
>>>>>>>>> +
>>>>>>>>> +static struct attribute *pwm_tach_attrs[] = {
>>>>>>>>> + &sensor_dev_attr_rpm.dev_attr.attr,
>>>>>>>>> + NULL,
>>>>>>>>> +};
>>>>>>>>
>>>>>>>> "rpm" is not a standard hwmon sysfs attribute. If you don't provide
>>>>>>>> a single standard hwmon sysfs attribute, having a hwmon driver
>>>>>>>> is pointless.
>>>>>>> Guenter Roeck,
>>>>>>> I will define a new hwmon sysfs attribute node called
>>>>>>> "hwmon_tachometer_attributes" in hwmon.h like below and update
>>>>>>> the same in tachometer hwmon driver. Is it fine ?
>>>>>>> enum hwmon_tachometer_attributes {
>>>>>>
>>>>>> Are you kidding me ?
>>>>>>
>>>>>> Guenter
>>>>> Sorry, I just wanted to confirm whether my understanding is correct
>>>>> or not before implementing it actually.
>>>>> Or, shall I add this attribute as a part of fan attributes with
>>>>> "hwmon_fan_rpm" ? or any other way to do it ? I need your inputs in
>>>>> fixing this.
>>>>
>>>> I think he wants the attribute to be named according to the
>>>> properties in this document:
>>>> https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface. I
>>>> guess the attribute would then map to fan1_input, though I'm not
>>>> sure if that's 100% correct either since this could technically be
>>>> attached to something other than a fan. But I would think in
>>>> practice that's not a big concern.
>>>>
>>>> Guenter,
>>>> Please correct me as well if I'm wrong.
>>>>
>>> You are absolutely correct.
>>>
>>> While I am not opposed to ABI changes, the merits of those would need
>>> to be
>>> discussed on the mailing list. But replacing "fan1_input" with "rpm" is
>>> not an acceptable ABI change, even if it may measure something that
>>> turns
>>> but isn't a fan.
>>>
>>> If this _is_ in fact supposed to be used for something else but fans, we
>>> would have to discuss what that might be, and if hwmon is the
>>> appropriate
>>> subsystem to measure and report it. This does to some degree lead
>>> back to
>>> my concern of having the "fan" part of this patch series in the pwm
>>> core.
>>> I am still not sure if that makes sense.
>>>
>>> Thanks,
>>> Guenter
>> I am planning to add tachometer support in pwm-fan.c driver
>> (drivers/hwmon/) instead of adding new generic-pwm-tachometer.c
>> driver. Measuring RPM value will be done in pwm-fan driver itself
>> using pwm capture feature and will add new sysfs attributes under this
>> driver to report rpm value of fan.
>
> There is an existing attribute to report the RPM of fans. It is called
> fan[1..n]_input.
>
> "replacing "fan1_input" with "rpm" is not an acceptable ABI change"
>
> Preemptive NACK.
>
> Guenter
>
I think the idea here (based on personal discussion with Rajkumar) was
to add a "new" sysfs attribute the driver exports, but that attribute
would be the existing fan[1..n]_input.
Mikko
>>>
>>>> Thank you,
>>>> Mikko
>>>>
>>>>>
>>>>> --
>>>>> To unsubscribe from this list: send the line "unsubscribe
>>>>> linux-tegra" in
>>>>> the body of a message to majordomo@vger.kernel.org
>>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe
>>>> linux-hwmon" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>>
>>>
>>
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH V2 5/7] thermal/drivers/cpu_cooling: Add idle cooling device documentation
From: Pavel Machek @ 2018-03-08 8:59 UTC (permalink / raw)
To: Daniel Lezcano
Cc: edubezval, kevin.wangtao, leo.yan, vincent.guittot, amit.kachhap,
linux-kernel, javi.merino, rui.zhang, daniel.thompson, linux-pm,
Jonathan Corbet, open list:DOCUMENTATION
In-Reply-To: <84fa8a3c-28bf-41ae-8ed7-9dd348b1cde9@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 3812 bytes --]
Hi!
> >> +Under certain circumstances, the SoC reaches a temperature exceeding
> >> +the allocated power budget or the maximum temperature limit. The
> >
> > I don't understand. Power budget is in W, temperature is in
> > kelvin. Temperature can't exceed power budget AFAICT.
>
> Yes, it is badly worded. Is the following better ?
>
> "
> Under certain circumstances a SoC can reach the maximum temperature
> limit or is unable to stabilize the temperature around a temperature
> control.
>
> When the SoC has to stabilize the temperature, the kernel can act on a
> cooling device to mitigate the dissipated power.
>
> When the maximum temperature is reached and to prevent a catastrophic
> situation a radical decision must be taken to reduce the temperature
> under the critical threshold, that impacts the performance.
>
> "
Actually... if hardware is expected to protect itself, I'd tone it
down. No need to be all catastrophic and critical... But yes, better.
> > Critical here, critical there. I have trouble following
> > it. Theoretically hardware should protect itself, because you don't
> > want kernel bug to damage your CPU?
>
> There are several levels of protection. The first level is mitigating
> the temperature from the kernel, then in the temperature sensor a reset
> line will trigger the reboot of the CPUs. Usually it is a register where
> you write the maximum temperature, from the driver itself. I never tried
> to write 1000°C in this register and see if I can burn the board.
>
> I know some boards have another level of thermal protection in the
> hardware itself and some other don't.
>
> In any case, from a kernel point of view, it is a critical situation as
> we are about to hard reboot the system and in this case it is preferable
> to drop drastically the performance but give the opportunity to the
> system to run in a degraded mode.
Agreed you want to keep going. In ACPI world, we shutdown when
critical trip point is reached, so this is somehow confusing.
> >> +Solutions:
> >> +----------
> >> +
> >> +If we can remove the static and the dynamic leakage for a specific
> >> +duration in a controlled period, the SoC temperature will
> >> +decrease. Acting at the idle state duration or the idle cycle
> >
> > "should" decrease? If you are in bad environment..
>
> No, it will decrease in any case because of the static leakage drop. The
> bad environment will impact the speed of this decrease.
I meant... if ambient temperature is 105C, there's not much you can do
to cool system down :-).
> >> +Idle Injection:
> >> +---------------
> >> +
> >> +The base concept of the idle injection is to force the CPU to go to an
> >> +idle state for a specified time each control cycle, it provides
> >> +another way to control CPU power and heat in addition to
> >> +cpufreq. Ideally, if all CPUs of a cluster inject idle synchronously,
> >> +this cluster can get into the deepest idle state and achieve minimum
> >> +power consumption, but that will also increase system response latency
> >> +if we inject less than cpuidle latency.
> >
> > I don't understand last sentence.
>
> Is it better ?
>
> "Ideally, if all CPUs, belonging to the same cluster, inject their idle
> cycle synchronously, the cluster can reach its power down state with a
> minimum power consumption and static leakage drop. However, these idle
> cycles injection will add extra latencies as the CPUs will have to
> wakeup from a deep sleep state."
Extra comma "CPUs , belonging". But yes, better.
> Thanks!
You are welcome. Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: [PATCH V2 5/7] thermal/drivers/cpu_cooling: Add idle cooling device documentation
From: Daniel Thompson @ 2018-03-08 11:54 UTC (permalink / raw)
To: Pavel Machek
Cc: Daniel Lezcano, edubezval, kevin.wangtao, leo.yan,
vincent.guittot, amit.kachhap, linux-kernel, javi.merino,
rui.zhang, linux-pm, Jonathan Corbet, open list:DOCUMENTATION
In-Reply-To: <20180308085949.GB17761@amd>
On Thu, Mar 08, 2018 at 09:59:49AM +0100, Pavel Machek wrote:
> Hi!
>
> > >> +Under certain circumstances, the SoC reaches a temperature exceeding
> > >> +the allocated power budget or the maximum temperature limit. The
> > >
> > > I don't understand. Power budget is in W, temperature is in
> > > kelvin. Temperature can't exceed power budget AFAICT.
> >
> > Yes, it is badly worded. Is the following better ?
> >
> > "
> > Under certain circumstances a SoC can reach the maximum temperature
> > limit or is unable to stabilize the temperature around a temperature
> > control.
> >
> > When the SoC has to stabilize the temperature, the kernel can act on a
> > cooling device to mitigate the dissipated power.
> >
> > When the maximum temperature is reached and to prevent a catastrophic
> > situation a radical decision must be taken to reduce the temperature
> > under the critical threshold, that impacts the performance.
> >
> > "
>
> Actually... if hardware is expected to protect itself, I'd tone it
> down. No need to be all catastrophic and critical... But yes, better.
Makes sense. For a thermally overcommitted but passively cooled device
work close to max operating temperature it is not a critical situation
requiring a radical reaction, it is normal operation.
Put another way, it would severely bogus to attach KERN_CRITICAL
messages to reaching the cooling threshold.
Daniel.
> > > Critical here, critical there. I have trouble following
> > > it. Theoretically hardware should protect itself, because you don't
> > > want kernel bug to damage your CPU?
> >
> > There are several levels of protection. The first level is mitigating
> > the temperature from the kernel, then in the temperature sensor a reset
> > line will trigger the reboot of the CPUs. Usually it is a register where
> > you write the maximum temperature, from the driver itself. I never tried
> > to write 1000°C in this register and see if I can burn the board.
> >
> > I know some boards have another level of thermal protection in the
> > hardware itself and some other don't.
> >
> > In any case, from a kernel point of view, it is a critical situation as
> > we are about to hard reboot the system and in this case it is preferable
> > to drop drastically the performance but give the opportunity to the
> > system to run in a degraded mode.
>
> Agreed you want to keep going. In ACPI world, we shutdown when
> critical trip point is reached, so this is somehow confusing.
>
> > >> +Solutions:
> > >> +----------
> > >> +
> > >> +If we can remove the static and the dynamic leakage for a specific
> > >> +duration in a controlled period, the SoC temperature will
> > >> +decrease. Acting at the idle state duration or the idle cycle
> > >
> > > "should" decrease? If you are in bad environment..
> >
> > No, it will decrease in any case because of the static leakage drop. The
> > bad environment will impact the speed of this decrease.
>
> I meant... if ambient temperature is 105C, there's not much you can do
> to cool system down :-).
>
> > >> +Idle Injection:
> > >> +---------------
> > >> +
> > >> +The base concept of the idle injection is to force the CPU to go to an
> > >> +idle state for a specified time each control cycle, it provides
> > >> +another way to control CPU power and heat in addition to
> > >> +cpufreq. Ideally, if all CPUs of a cluster inject idle synchronously,
> > >> +this cluster can get into the deepest idle state and achieve minimum
> > >> +power consumption, but that will also increase system response latency
> > >> +if we inject less than cpuidle latency.
> > >
> > > I don't understand last sentence.
> >
> > Is it better ?
> >
> > "Ideally, if all CPUs, belonging to the same cluster, inject their idle
> > cycle synchronously, the cluster can reach its power down state with a
> > minimum power consumption and static leakage drop. However, these idle
> > cycles injection will add extra latencies as the CPUs will have to
> > wakeup from a deep sleep state."
>
> Extra comma "CPUs , belonging". But yes, better.
>
> > Thanks!
>
> You are welcome. Best regards,
> Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 2/4] soc: qcom: Add GENI based QUP Wrapper driver
From: Robin Murphy @ 2018-03-08 13:24 UTC (permalink / raw)
To: Karthik Ramasubramanian, Stephen Boyd, Stephen Boyd, andy.gross,
corbet, david.brown, gregkh, mark.rutland, robh+dt, wsa, hch,
m.szyprowski
Cc: linux-doc, linux-arm-msm, devicetree, linux-i2c, linux-serial,
jslaby, evgreen, acourbot, Sagar Dharia, Girish Mahadevan, iommu
In-Reply-To: <945b6c00-dde6-6ec7-4577-4cc0d034796b@codeaurora.org>
On 08/03/18 06:46, Karthik Ramasubramanian wrote:
>
>
> On 3/6/2018 2:56 PM, Stephen Boyd wrote:
>> Quoting Karthik Ramasubramanian (2018-03-02 16:58:23)
>>
>>>>> + return iova;
>>>>> +}
>>>>> +EXPORT_SYMBOL(geni_se_tx_dma_prep);
>>>>> +
>>>>> +/**
>>>>> + * geni_se_rx_dma_prep() - Prepare the Serial Engine for RX DMA
>>>>> transfer
>>>>> + * @se: Pointer to the concerned Serial
>>>>> Engine.
>>>>> + * @buf: Pointer to the RX buffer.
>>>>> + * @len: Length of the RX buffer.
>>>>> + *
>>>>> + * This function is used to prepare the buffers for DMA RX.
>>>>> + *
>>>>> + * Return: Mapped DMA Address of the buffer on success, NULL on
>>>>> failure.
>>>>> + */
>>>>> +dma_addr_t geni_se_rx_dma_prep(struct geni_se *se, void *buf,
>>>>> size_t len)
>>>>> +{
>>>>> + dma_addr_t iova;
>>>>> + struct geni_wrapper *wrapper = se->wrapper;
>>>>> + u32 val;
>>>>> +
>>>>> + iova = dma_map_single(wrapper->dev, buf, len,
>>>>> DMA_FROM_DEVICE);
>>>>> + if (dma_mapping_error(wrapper->dev, iova))
>>>>> + return (dma_addr_t)NULL;
>>>>
>>>> Can't return a dma_mapping_error address to the caller and have them
>>>> figure it out?
>>> Earlier we used to return the DMA_ERROR_CODE which has been removed
>>> recently in arm64 architecture. If we return the dma_mapping_error, then
>>> the caller also needs the device which encountered the mapping error.
>>> The serial interface drivers can use their parent currently to resolve
>>> the mapping error. Once the wrapper starts mapping using IOMMU context
>>> bank, then the serial interface drivers do not know which device to use
>>> to know if there is an error.
>>>
>>> Having said that, the dma_ops suggestion might help with handling this
>>> situation. I will look into it further.
>>
>> Ok, thanks.
>>
>>>>> +{
>>>>> + struct geni_wrapper *wrapper = se->wrapper;
>>>>> +
>>>>> + if (iova)
>>>>> + dma_unmap_single(wrapper->dev, iova, len,
>>>>> DMA_FROM_DEVICE);
>>>>> +}
>>>>> +EXPORT_SYMBOL(geni_se_rx_dma_unprep);
>>>>
>>>> Instead of having the functions exported, could we set the dma_ops on
>>>> all child devices of the wrapper that this driver populates and then
>>>> implement the DMA ops for those devices here? I assume that there's
>>>> never another DMA master between the wrapper and the serial engine,
>>>> so I
>>>> think it would work.
>>> This suggestion looks like it will work.
>>
>> It would be a good idea to check with some other people on the dma_ops
>> suggestion. Maybe add the DMA mapping subsystem folks to help out here
> I have added the DMA mapping subsystem folks to help out here.
>
> To present an overview, we have a wrapper controller which is composed
> of several serial engines. The serial engines are programmed with UART,
> I2C or SPI protocol and support DMA transfer. When the serial engines
> perform DMA transfer, the wrapper controller device is used to perform
> the mapping. The reason wrapper device is used is because of IOMMU and
> there is only one IOMMU context bank to perform the translation for the
> entire wrapper controller. So the wrapper controller exports map and
> unmap functions to the individual protocol drivers.
>
> There is a suggestion to make the parent wrapper controller implement
> the dma_map_ops, instead of exported map/unmap functions and populate
> those dma_map_ops on all the children serial engines. Can you please
> provide your inputs regarding this suggestion?
Implementing dma_map_ops inside a driver for real hardware is almost
always the wrong thing to do.
Based on what I could infer about the hardware from looking through the
whole series in the linux-arm-msm archive, this is probably more like a
multi-channel DMA controller where each "channel" has a configurable
serial interface on the other end, as opposed to an actual bus where the
serial engines are individually distinct AHB masters routed through the
wrapper. If that's true, then using the QUP platform device for DMA API
calls is the appropriate thing to do. Personally I'd be inclined not to
abstract the dma_{map,unmap} calls at all, and just have the protocol
drivers make them directly using dev->parent/wrapper->dev/whatever, but
if you do want to abstract those then just give the abstraction a saner
interface, i.e. pass the DMA handle by reference and return a regular
int for error/success status.
Robin.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 05/10] hwmon: generic-pwm-tachometer: Add generic PWM based tachometer
From: Guenter Roeck @ 2018-03-08 14:31 UTC (permalink / raw)
To: Laxman Dewangan, Rajkumar Rampelli, Mikko Perttunen, robh+dt,
mark.rutland, thierry.reding, jonathanh, jdelvare, corbet,
catalin.marinas, will.deacon, kstewart, gregkh, pombredanne,
mmaddireddy, mperttunen, arnd, timur, andy.gross, xuwei5, elder,
heiko, krzk, ard.biesheuvel
Cc: devicetree, linux-kernel, linux-pwm, linux-tegra, linux-hwmon,
linux-doc, linux-arm-kernel
In-Reply-To: <5bffef40-a4a7-5f7d-a448-b2a381c57822@nvidia.com>
On 03/07/2018 10:06 PM, Laxman Dewangan wrote:
>
>
> On Wednesday 07 March 2018 07:50 PM, Guenter Roeck wrote:
>> On 03/07/2018 01:47 AM, Rajkumar Rampelli wrote:
>>>
>>>>
>>>> While I am not opposed to ABI changes, the merits of those would need to be
>>>> discussed on the mailing list. But replacing "fan1_input" with "rpm" is
>>>> not an acceptable ABI change, even if it may measure something that turns
>>>> but isn't a fan.
>>>>
>>>> If this _is_ in fact supposed to be used for something else but fans, we
>>>> would have to discuss what that might be, and if hwmon is the appropriate
>>>> subsystem to measure and report it. This does to some degree lead back to
>>>> my concern of having the "fan" part of this patch series in the pwm core.
>>>> I am still not sure if that makes sense.
>>>>
>>>> Thanks,
>>>> Guenter
>>> I am planning to add tachometer support in pwm-fan.c driver (drivers/hwmon/) instead of adding new generic-pwm-tachometer.c driver. Measuring RPM value will be done in pwm-fan driver itself using pwm capture feature and will add new sysfs attributes under this driver to report rpm value of fan.
>>
>> There is an existing attribute to report the RPM of fans. It is called fan[1..n]_input.
>>
>> "replacing "fan1_input" with "rpm" is not an acceptable ABI change"
>>
>> Preemptive NACK.
>
> The RPM is measured speed via PWM signal capture which is output from fan.
> So should we have the fan[1..n]_output_rpm?
>
No. I hear you clearly that you for some reason dislike fan[1..n]_input.
While ABIs are not always to our liking, that doesn't mean that we get
to change them at our whim. If that is not acceptable for you, I can't
help you. And you can't change inX_input to inX_voltage either, sorry.
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 05/10] hwmon: generic-pwm-tachometer: Add generic PWM based tachometer
From: Guenter Roeck @ 2018-03-08 14:33 UTC (permalink / raw)
To: Mikko Perttunen, Rajkumar Rampelli, Mikko Perttunen, robh+dt,
mark.rutland, thierry.reding, jonathanh, jdelvare, corbet,
catalin.marinas, will.deacon, kstewart, gregkh, pombredanne,
mmaddireddy, arnd, timur, andy.gross, xuwei5, elder, heiko, krzk,
ard.biesheuvel
Cc: devicetree, linux-kernel, linux-pwm, linux-tegra, linux-hwmon,
linux-doc, linux-arm-kernel, ldewangan
In-Reply-To: <73ca5840-865b-b44e-45e6-703b7749fb6f@nvidia.com>
On 03/07/2018 11:57 PM, Mikko Perttunen wrote:
>
>
> On 07.03.2018 16:20, Guenter Roeck wrote:
>> On 03/07/2018 01:47 AM, Rajkumar Rampelli wrote:
>>>
>>>
>>> On Wednesday 28 February 2018 07:59 PM, Guenter Roeck wrote:
>>>> On 02/27/2018 11:03 PM, Mikko Perttunen wrote:
>>>>> On 02/28/2018 08:12 AM, Rajkumar Rampelli wrote:
>>>>>>
>>>>>> On Wednesday 28 February 2018 11:28 AM, Guenter Roeck wrote:
>>>>>>> On 02/27/2018 09:38 PM, Rajkumar Rampelli wrote:
>>>>>>>>
>>>>>>>> On Wednesday 21 February 2018 08:20 PM, Guenter Roeck wrote:
>>>>>>>>> On 02/20/2018 10:58 PM, Rajkumar Rampelli wrote:
>>>>>>>>>> Add generic PWM based tachometer driver via HWMON interface
>>>>>>>>>> to report the RPM of motor. This drivers get the period/duty
>>>>>>>>>> cycle from PWM IP which captures the motor PWM output.
>>>>>>>>>>
>>>>>>>>>> This driver implements a simple interface for monitoring the
>>>>>>>>>> speed of
>>>>>>>>>> a fan and exposes it in roatations per minute (RPM) to the user
>>>>>>>>>> space
>>>>>>>>>> by using the hwmon's sysfs interface
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Rajkumar Rampelli <rrajk@nvidia.com>
>>>>>>>>>> ---
>>>>>>>>>> Documentation/hwmon/generic-pwm-tachometer | 17 +++++
>>>>>>>>>> drivers/hwmon/Kconfig | 10 +++
>>>>>>>>>> drivers/hwmon/Makefile | 1 +
>>>>>>>>>> drivers/hwmon/generic-pwm-tachometer.c | 112
>>>>>>>>>> +++++++++++++++++++++++++++++
>>>>>>>>>> 4 files changed, 140 insertions(+)
>>>>>>>>>> create mode 100644 Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>>> create mode 100644 drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>>>
>>>>>>>>>> diff --git a/Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>>> b/Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>>> new file mode 100644
>>>>>>>>>> index 0000000..e0713ee
>>>>>>>>>> --- /dev/null
>>>>>>>>>> +++ b/Documentation/hwmon/generic-pwm-tachometer
>>>>>>>>>> @@ -0,0 +1,17 @@
>>>>>>>>>> +Kernel driver generic-pwm-tachometer
>>>>>>>>>> +====================================
>>>>>>>>>> +
>>>>>>>>>> +This driver enables the use of a PWM module to monitor a fan.
>>>>>>>>>> It uses the
>>>>>>>>>> +generic PWM interface and can be used on SoCs as along as the
>>>>>>>>>> SoC supports
>>>>>>>>>> +Tachometer controller that moniors the Fan speed in periods.
>>>>>>>>>> +
>>>>>>>>>> +Author: Rajkumar Rampelli <rrajk@nvidia.com>
>>>>>>>>>> +
>>>>>>>>>> +Description
>>>>>>>>>> +-----------
>>>>>>>>>> +
>>>>>>>>>> +The driver implements a simple interface for monitoring the
>>>>>>>>>> Fan speed using
>>>>>>>>>> +PWM module and Tachometer controller. It requests period value
>>>>>>>>>> through PWM
>>>>>>>>>> +capture interface to Tachometer and measures the Rotations per
>>>>>>>>>> minute using
>>>>>>>>>> +received period value. It exposes the Fan speed in RPM to the
>>>>>>>>>> user space by
>>>>>>>>>> +using the hwmon's sysfs interface.
>>>>>>>>>> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
>>>>>>>>>> index ef23553..8912dcb 100644
>>>>>>>>>> --- a/drivers/hwmon/Kconfig
>>>>>>>>>> +++ b/drivers/hwmon/Kconfig
>>>>>>>>>> @@ -1878,6 +1878,16 @@ config SENSORS_XGENE
>>>>>>>>>> If you say yes here you get support for the temperature
>>>>>>>>>> and power sensors for APM X-Gene SoC.
>>>>>>>>>> +config GENERIC_PWM_TACHOMETER
>>>>>>>>>> + tristate "Generic PWM based tachometer driver"
>>>>>>>>>> + depends on PWM
>>>>>>>>>> + help
>>>>>>>>>> + Enables a driver to use PWM signal from motor to use
>>>>>>>>>> + for measuring the motor speed. The RPM is captured by
>>>>>>>>>> + PWM modules which has PWM capture capability and this
>>>>>>>>>> + drivers reads the captured data from PWM IP to convert
>>>>>>>>>> + it to speed in RPM.
>>>>>>>>>> +
>>>>>>>>>> if ACPI
>>>>>>>>>> comment "ACPI drivers"
>>>>>>>>>> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
>>>>>>>>>> index f814b4a..9dcc374 100644
>>>>>>>>>> --- a/drivers/hwmon/Makefile
>>>>>>>>>> +++ b/drivers/hwmon/Makefile
>>>>>>>>>> @@ -175,6 +175,7 @@ obj-$(CONFIG_SENSORS_WM8350) +=
>>>>>>>>>> wm8350-hwmon.o
>>>>>>>>>> obj-$(CONFIG_SENSORS_XGENE) += xgene-hwmon.o
>>>>>>>>>> obj-$(CONFIG_PMBUS) += pmbus/
>>>>>>>>>> +obj-$(CONFIG_GENERIC_PWM_TACHOMETER) += generic-pwm-tachometer.o
>>>>>>>>>> ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
>>>>>>>>>> diff --git a/drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>>> b/drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>>> new file mode 100644
>>>>>>>>>> index 0000000..9354d43
>>>>>>>>>> --- /dev/null
>>>>>>>>>> +++ b/drivers/hwmon/generic-pwm-tachometer.c
>>>>>>>>>> @@ -0,0 +1,112 @@
>>>>>>>>>> +/*
>>>>>>>>>> + * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights
>>>>>>>>>> reserved.
>>>>>>>>>> + *
>>>>>>>>>> + * This program is free software; you can redistribute it
>>>>>>>>>> and/or modify it
>>>>>>>>>> + * under the terms and conditions of the GNU General Public
>>>>>>>>>> License,
>>>>>>>>>> + * version 2, as published by the Free Software Foundation.
>>>>>>>>>> + *
>>>>>>>>>> + * This program is distributed in the hope it will be useful,
>>>>>>>>>> but WITHOUT
>>>>>>>>>> + * ANY WARRANTY; without even the implied warranty of
>>>>>>>>>> MERCHANTABILITY or
>>>>>>>>>> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
>>>>>>>>>> Public License for
>>>>>>>>>> + * more details.
>>>>>>>>>> + *
>>>>>>>>>> + */
>>>>>>>>>> +
>>>>>>>>>> +#include <linux/module.h>
>>>>>>>>>> +#include <linux/platform_device.h>
>>>>>>>>>> +#include <linux/err.h>
>>>>>>>>>> +#include <linux/pwm.h>
>>>>>>>>>> +#include <linux/hwmon.h>
>>>>>>>>>> +#include <linux/hwmon-sysfs.h>
>>>>>>>>>> +
>>>>>>>>>> +struct pwm_hwmon_tach {
>>>>>>>>>> + struct device *dev;
>>>>>>>>>> + struct pwm_device *pwm;
>>>>>>>>>> + struct device *hwmon;
>>>>>>>>>> +};
>>>>>>>>>> +
>>>>>>>>>> +static ssize_t show_rpm(struct device *dev, struct
>>>>>>>>>> device_attribute *attr,
>>>>>>>>>> + char *buf)
>>>>>>>>>> +{
>>>>>>>>>> + struct pwm_hwmon_tach *ptt = dev_get_drvdata(dev);
>>>>>>>>>> + struct pwm_device *pwm = ptt->pwm;
>>>>>>>>>> + struct pwm_capture result;
>>>>>>>>>> + int err;
>>>>>>>>>> + unsigned int rpm = 0;
>>>>>>>>>> +
>>>>>>>>>> + err = pwm_capture(pwm, &result, 0);
>>>>>>>>>> + if (err < 0) {
>>>>>>>>>> + dev_err(ptt->dev, "Failed to capture PWM: %d\n", err);
>>>>>>>>>> + return err;
>>>>>>>>>> + }
>>>>>>>>>> +
>>>>>>>>>> + if (result.period)
>>>>>>>>>> + rpm = DIV_ROUND_CLOSEST_ULL(60ULL * NSEC_PER_SEC,
>>>>>>>>>> + result.period);
>>>>>>>>>> +
>>>>>>>>>> + return sprintf(buf, "%u\n", rpm);
>>>>>>>>>> +}
>>>>>>>>>> +
>>>>>>>>>> +static SENSOR_DEVICE_ATTR(rpm, 0444, show_rpm, NULL, 0);
>>>>>>>>>> +
>>>>>>>>>> +static struct attribute *pwm_tach_attrs[] = {
>>>>>>>>>> + &sensor_dev_attr_rpm.dev_attr.attr,
>>>>>>>>>> + NULL,
>>>>>>>>>> +};
>>>>>>>>>
>>>>>>>>> "rpm" is not a standard hwmon sysfs attribute. If you don't provide
>>>>>>>>> a single standard hwmon sysfs attribute, having a hwmon driver
>>>>>>>>> is pointless.
>>>>>>>> Guenter Roeck,
>>>>>>>> I will define a new hwmon sysfs attribute node called
>>>>>>>> "hwmon_tachometer_attributes" in hwmon.h like below and update
>>>>>>>> the same in tachometer hwmon driver. Is it fine ?
>>>>>>>> enum hwmon_tachometer_attributes {
>>>>>>>
>>>>>>> Are you kidding me ?
>>>>>>>
>>>>>>> Guenter
>>>>>> Sorry, I just wanted to confirm whether my understanding is correct
>>>>>> or not before implementing it actually.
>>>>>> Or, shall I add this attribute as a part of fan attributes with
>>>>>> "hwmon_fan_rpm" ? or any other way to do it ? I need your inputs in
>>>>>> fixing this.
>>>>>
>>>>> I think he wants the attribute to be named according to the
>>>>> properties in this document:
>>>>> https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface. I
>>>>> guess the attribute would then map to fan1_input, though I'm not
>>>>> sure if that's 100% correct either since this could technically be
>>>>> attached to something other than a fan. But I would think in
>>>>> practice that's not a big concern.
>>>>>
>>>>> Guenter,
>>>>> Please correct me as well if I'm wrong.
>>>>>
>>>> You are absolutely correct.
>>>>
>>>> While I am not opposed to ABI changes, the merits of those would need
>>>> to be
>>>> discussed on the mailing list. But replacing "fan1_input" with "rpm" is
>>>> not an acceptable ABI change, even if it may measure something that
>>>> turns
>>>> but isn't a fan.
>>>>
>>>> If this _is_ in fact supposed to be used for something else but fans, we
>>>> would have to discuss what that might be, and if hwmon is the
>>>> appropriate
>>>> subsystem to measure and report it. This does to some degree lead
>>>> back to
>>>> my concern of having the "fan" part of this patch series in the pwm
>>>> core.
>>>> I am still not sure if that makes sense.
>>>>
>>>> Thanks,
>>>> Guenter
>>> I am planning to add tachometer support in pwm-fan.c driver
>>> (drivers/hwmon/) instead of adding new generic-pwm-tachometer.c
>>> driver. Measuring RPM value will be done in pwm-fan driver itself
>>> using pwm capture feature and will add new sysfs attributes under this
>>> driver to report rpm value of fan.
>>
>> There is an existing attribute to report the RPM of fans. It is called
>> fan[1..n]_input.
>>
>> "replacing "fan1_input" with "rpm" is not an acceptable ABI change"
>>
>> Preemptive NACK.
>>
>> Guenter
>>
>
> I think the idea here (based on personal discussion with Rajkumar) was to add a "new" sysfs attribute the driver exports, but that attribute would be the existing fan[1..n]_input.
>
Ah, sorry, in this case misunderstanding on my side.
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 2/4] soc: qcom: Add GENI based QUP Wrapper driver
From: Christoph Hellwig @ 2018-03-08 14:41 UTC (permalink / raw)
To: Robin Murphy
Cc: Karthik Ramasubramanian, Stephen Boyd, Stephen Boyd, andy.gross,
corbet, david.brown, gregkh, mark.rutland, robh+dt, wsa, hch,
m.szyprowski, linux-doc, linux-arm-msm, devicetree, linux-i2c,
linux-serial, jslaby, evgreen, acourbot, Sagar Dharia,
Girish Mahadevan, iommu
In-Reply-To: <8567be1b-1431-4f1d-cb41-6a7eaa434438@arm.com>
On Thu, Mar 08, 2018 at 01:24:45PM +0000, Robin Murphy wrote:
> Implementing dma_map_ops inside a driver for real hardware is almost always
> the wrong thing to do.
Agreed. dma_map_ops should be a platform decision based on the bus.
Even our dma_virt_ops basically just works around bad driver layering.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 05/10] hwmon: generic-pwm-tachometer: Add generic PWM based tachometer
From: Laxman Dewangan @ 2018-03-08 15:21 UTC (permalink / raw)
To: Guenter Roeck, Rajkumar Rampelli, Mikko Perttunen, robh+dt,
mark.rutland, thierry.reding, jonathanh, jdelvare, corbet,
catalin.marinas, will.deacon, kstewart, gregkh, pombredanne,
mmaddireddy, mperttunen, arnd, timur, andy.gross, xuwei5, elder,
heiko, krzk, ard.biesheuvel
Cc: devicetree, linux-kernel, linux-pwm, linux-tegra, linux-hwmon,
linux-doc, linux-arm-kernel
In-Reply-To: <d4e745a6-5534-662e-f6d5-a91bf580f550@roeck-us.net>
On Thursday 08 March 2018 08:01 PM, Guenter Roeck wrote:
> On 03/07/2018 10:06 PM, Laxman Dewangan wrote:
>>
>>
>> The RPM is measured speed via PWM signal capture which is output
>> from fan.
>> So should we have the fan[1..n]_output_rpm?
>>
>
> No. I hear you clearly that you for some reason dislike fan[1..n]_input.
> While ABIs are not always to our liking, that doesn't mean that we get
> to change them at our whim. If that is not acceptable for you, I can't
> help you. And you can't change inX_input to inX_voltage either, sorry.
My opinion is only to not use "input" as this is not really the input to
fan.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] [v2] docs: clarify security-bugs disclosure policy
From: Greg KH @ 2018-03-08 17:15 UTC (permalink / raw)
To: Dave Hansen
Cc: linux-kernel, dan.j.williams, tglx, torvalds, gnomes, aarcange,
luto, keescook, tim.c.chen, viro, akpm, linux-doc, corbet,
mark.rutland
In-Reply-To: <20180307214624.D4361772@viggo.jf.intel.com>
On Wed, Mar 07, 2018 at 01:46:24PM -0800, Dave Hansen wrote:
>
> From: Dave Hansen <dave.hansen@linux.intel.com>
>
> I think we need to soften the language a bit. It might scare folks
> off, especially the:
>
> We prefer to fully disclose the bug as soon as possible.
>
> which is not really the case. Linus says:
>
> It's not full disclosure, it's not coordinated disclosure,
> and it's not "no disclosure". It's more like just "timely
> open fixes".
>
> I changed a bit of the wording in here, but mostly to remove the word
> "disclosure" since it seems to mean very specific things to people
> that we do not mean here.
>
> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Cc: Kees Cook <keescook@google.com>
> Cc: Tim Chen <tim.c.chen@linux.intel.com>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-doc@vger.kernel.org
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Mark Rutland <mark.rutland@arm.com>
> ---
>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] [v2] docs: clarify security-bugs disclosure policy
From: Jonathan Corbet @ 2018-03-08 17:28 UTC (permalink / raw)
To: Linus Torvalds
Cc: Dave Hansen, Linux Kernel Mailing List, Dan Williams,
Thomas Gleixner, Greg Kroah-Hartman, One Thousand Gnomes,
Andrea Arcangeli, Andrew Lutomirski, Kees Cook, Tim Chen, Al Viro,
Andrew Morton, open list:DOCUMENTATION, Mark Rutland
In-Reply-To: <CA+55aFzii9Sd3MaLz=FPf1Z_aAsZU16_+q-pvkSGHhU4-7QS9Q@mail.gmail.com>
On Wed, 7 Mar 2018 13:53:06 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> I'm guessing this will go through Jon?
Sounds like a fine guess to me; will apply shortly.
Thanks,
jon
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 2/4] soc: qcom: Add GENI based QUP Wrapper driver
From: Karthik Ramasubramanian @ 2018-03-08 18:18 UTC (permalink / raw)
To: Robin Murphy, Stephen Boyd, Stephen Boyd, andy.gross, corbet,
david.brown, gregkh, mark.rutland, robh+dt, wsa, hch,
m.szyprowski
Cc: linux-doc, linux-arm-msm, devicetree, linux-i2c, linux-serial,
jslaby, evgreen, acourbot, Sagar Dharia, Girish Mahadevan, iommu
In-Reply-To: <8567be1b-1431-4f1d-cb41-6a7eaa434438@arm.com>
On 3/8/2018 6:24 AM, Robin Murphy wrote:
> On 08/03/18 06:46, Karthik Ramasubramanian wrote:
>>
>>
>> On 3/6/2018 2:56 PM, Stephen Boyd wrote:
>>> Quoting Karthik Ramasubramanian (2018-03-02 16:58:23)
>>>
>>>>>> + return iova;
>>>>>> +}
>>>>>> +EXPORT_SYMBOL(geni_se_tx_dma_prep);
>>>>>> +
>>>>>> +/**
>>>>>> + * geni_se_rx_dma_prep() - Prepare the Serial Engine for RX DMA
>>>>>> transfer
>>>>>> + * @se: Pointer to the concerned Serial
>>>>>> Engine.
>>>>>> + * @buf: Pointer to the RX buffer.
>>>>>> + * @len: Length of the RX buffer.
>>>>>> + *
>>>>>> + * This function is used to prepare the buffers for DMA RX.
>>>>>> + *
>>>>>> + * Return: Mapped DMA Address of the buffer on success, NULL on
>>>>>> failure.
>>>>>> + */
>>>>>> +dma_addr_t geni_se_rx_dma_prep(struct geni_se *se, void *buf,
>>>>>> size_t len)
>>>>>> +{
>>>>>> + dma_addr_t iova;
>>>>>> + struct geni_wrapper *wrapper = se->wrapper;
>>>>>> + u32 val;
>>>>>> +
>>>>>> + iova = dma_map_single(wrapper->dev, buf, len,
>>>>>> DMA_FROM_DEVICE);
>>>>>> + if (dma_mapping_error(wrapper->dev, iova))
>>>>>> + return (dma_addr_t)NULL;
>>>>>
>>>>> Can't return a dma_mapping_error address to the caller and have them
>>>>> figure it out?
>>>> Earlier we used to return the DMA_ERROR_CODE which has been removed
>>>> recently in arm64 architecture. If we return the dma_mapping_error,
>>>> then
>>>> the caller also needs the device which encountered the mapping error.
>>>> The serial interface drivers can use their parent currently to resolve
>>>> the mapping error. Once the wrapper starts mapping using IOMMU context
>>>> bank, then the serial interface drivers do not know which device to use
>>>> to know if there is an error.
>>>>
>>>> Having said that, the dma_ops suggestion might help with handling this
>>>> situation. I will look into it further.
>>>
>>> Ok, thanks.
>>>
>>>>>> +{
>>>>>> + struct geni_wrapper *wrapper = se->wrapper;
>>>>>> +
>>>>>> + if (iova)
>>>>>> + dma_unmap_single(wrapper->dev, iova, len,
>>>>>> DMA_FROM_DEVICE);
>>>>>> +}
>>>>>> +EXPORT_SYMBOL(geni_se_rx_dma_unprep);
>>>>>
>>>>> Instead of having the functions exported, could we set the dma_ops on
>>>>> all child devices of the wrapper that this driver populates and then
>>>>> implement the DMA ops for those devices here? I assume that there's
>>>>> never another DMA master between the wrapper and the serial engine,
>>>>> so I
>>>>> think it would work.
>>>> This suggestion looks like it will work.
>>>
>>> It would be a good idea to check with some other people on the dma_ops
>>> suggestion. Maybe add the DMA mapping subsystem folks to help out here
>> I have added the DMA mapping subsystem folks to help out here.
>>
>> To present an overview, we have a wrapper controller which is composed
>> of several serial engines. The serial engines are programmed with
>> UART, I2C or SPI protocol and support DMA transfer. When the serial
>> engines perform DMA transfer, the wrapper controller device is used to
>> perform the mapping. The reason wrapper device is used is because of
>> IOMMU and there is only one IOMMU context bank to perform the
>> translation for the entire wrapper controller. So the wrapper
>> controller exports map and unmap functions to the individual protocol
>> drivers.
>>
>> There is a suggestion to make the parent wrapper controller implement
>> the dma_map_ops, instead of exported map/unmap functions and populate
>> those dma_map_ops on all the children serial engines. Can you please
>> provide your inputs regarding this suggestion?
>
> Implementing dma_map_ops inside a driver for real hardware is almost
> always the wrong thing to do.
>
> Based on what I could infer about the hardware from looking through the
> whole series in the linux-arm-msm archive, this is probably more like a
> multi-channel DMA controller where each "channel" has a configurable
> serial interface on the other end, as opposed to an actual bus where the
> serial engines are individually distinct AHB masters routed through the
> wrapper. If that's true, then using the QUP platform device for DMA API
> calls is the appropriate thing to do. Personally I'd be inclined not to
> abstract the dma_{map,unmap} calls at all, and just have the protocol
> drivers make them directly using dev->parent/wrapper->dev/whatever, but
> if you do want to abstract those then just give the abstraction a saner
> interface, i.e. pass the DMA handle by reference and return a regular
> int for error/success status.
>
> Robin.
Thank you Robin & Christoph for your inputs. The wrapper driver used to
provide the recommended abstraction until v2 of this patch series. In v3
it was tweaked to address a comment. If there are no objections, I will
revive it back.
Regards,
Karthik.
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [v3, 3/4] i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller
From: Doug Anderson @ 2018-03-08 21:12 UTC (permalink / raw)
To: Sagar Dharia
Cc: Jonathan Corbet, Andy Gross, David Brown, Rob Herring,
Mark Rutland, Wolfram Sang, Greg Kroah-Hartman,
Karthikeyan Ramasubramanian, linux-doc, linux-arm-msm, devicetree,
linux-i2c, linux-serial, Jiri Slaby, evgreen, acourbot,
Girish Mahadevan, swboyd
In-Reply-To: <CAD=FV=UXK_wYky83nmQdk4dQtVSCV9=o3i2590ZyUMcq4rrdKQ@mail.gmail.com>
Hi,
On Wed, Mar 7, 2018 at 9:19 PM, Doug Anderson <dianders@chromium.org> wrote:
>>> DMA is hard and i2c transfers > 32 bytes are rare. Do we really gain
>>> a lot by transferring i2c commands over DMA compared to a FIFO?
>>> Enough to justify the code complexity and the set of bugs that will
>>> show up? I'm sure it will be a controversial assertion given that the
>>> code's already written, but personally I'd be supportive of ripping
>>> DMA mode out to simplify the driver. I'd be curious if anyone else
>>> agrees. To me it seems like premature optimization.
>>
>>
>> Yes, we have multiple clients (e.g. touch, NFC) using I2C for data transfers
>> bigger than 32 bytes (some transfers are 100s of bytes). The fifo size is
>> 32, so we can definitely avoid at least 1 interrupt when DMA mode is used
>> with data size > 32.
>
> Does that 1-2 interrupts make any real difference, though? In theory
> it really shouldn't affect the transfer rate. We should be able to
> service the interrupt plenty fast and if we were concerned we would
> tweak the watermark code a little bit. So I guess we're worried about
> the extra CPU cycles (and power cost) to service those extra couple
> interrupts?
>
> In theory when touch data is coming in or NFC data is coming in then
> we're probably not in a super low power state to begin with. If it's
> touch data we likely want to have the CPU boosted a bunch to respond
> to the user quickly. If we've got 8 cores available all of which can
> run at 1GHz or more a few interrupts won't kill us. NFC data is
> probably not common enough that we need to optimize power/CPU
> utilizatoin for that.
>
>
> So while i can believe that you do save an interrupt or two, I still
> am not convinced that those interrupts are worth a bunch of complex
> code (and a whole second code path) to save.
>
>
> ...also note that above you said that coming out of runtime suspend
> can take several msec. That seems like it dwarfs any slight
> difference in timing between a FIFO-based operation and DMA.
One last note here (sorry for not thinking of this last night) is that
I would also be interested in considering _only_ supporting the DMA
path. Is it somehow intrinsically bad to use the DMA flow for a
1-byte transfer? Is there a bunch of extra overhead or power draw?
Specifically my main point is that maintaining two separate flows (the
FIFO flow vs the DMA flow) adds complexity, code size, and bugs. If
there's a really good reason to maintain both flows then fine, but we
should really consider if this is something that's really giving us
value before we agree to it.
-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 4/4] tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP
From: Stephen Boyd @ 2018-03-08 22:32 UTC (permalink / raw)
To: Karthik Ramasubramanian, andy.gross, corbet, david.brown, gregkh,
mark.rutland, robh+dt, wsa
Cc: linux-doc, linux-arm-msm, devicetree, linux-i2c, linux-serial,
jslaby, evgreen, acourbot, Girish Mahadevan, Sagar Dharia,
Doug Anderson
In-Reply-To: <d8089e60-9344-8a7e-502d-3e04e357811b@codeaurora.org>
Quoting Karthik Ramasubramanian (2018-03-07 22:06:29)
>
>
> On 3/6/2018 2:45 PM, Stephen Boyd wrote:
> > Quoting Karthik Ramasubramanian (2018-03-05 16:51:23)
> >> On 3/2/2018 3:11 PM, Stephen Boyd wrote:
> >
> > Ok. I've seen similar designs in some mmc drivers. For example, you can
> > look at drivers/mmc/host/meson-gx-mmc.c and see that they register a
> > clk_ops and then just start using that clk directly from the driver.
> > There are also some helper functions for dividers that would hopefully
> > make the job of calculating the best divider easier.
> Thanks for the pointers. I will take a look at it. In the meanwhile I
> had discussions with our clock team. They pointed out that the register
> to write the divider value here is outside the scope of clock controller
> which makes it trickier to implement your suggestion. They are already
> in the mailing list and we will discuss further and get back to you in
> this regard.
Ok. Let me know if I can help answer any questions.
> >>>
> >>> Why are these noirq variants? Please add a comment.
> >> The intention is to enable the console UART port usage as late as
> >> possible in the suspend cycle. Hence noirq variants. I will add this as
> >> a comment. Please let me know if the usage does not match the intention.
> >
> > Hm.. Does no_console_suspend not work? Or not work well enough?
> It works. When console suspend is disabled, the suspend operation does
> not get triggered and the resume operation checks if the console suspend
> is disabled and performs the needed thing.
Ok so then do we need the noirq variants? Or console suspend is special
enough for this to not matter?
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH 0/8] Move most GPIO documentation to driver-api/gpio/ and ReST
From: Jonathan Neuschäfer @ 2018-03-08 23:40 UTC (permalink / raw)
To: linux-gpio; +Cc: linux-kernel, linux-doc, Jonathan Neuschäfer
The aim of this patchset is to move the GPIO subsystem's documentation
under Documentation/driver-api/gpio/ such that it is picked up by Sphinx
and compiled into HTML. I moved everything except for sysfs.txt, because
this file describes the legacy sysfs ABI, and doesn't seem to serve much
(non-historical) purpose anymore.
There are still some rough edges:
* I think the API documentation (kernel-doc) should be moved out of
index.rst into more appropriate files.
* The headings are arguably wrong, because driver.rst, consumer.rst,
etc. use the "document title" style, even though they are part of the
GPIO chapter. But the resulting TOC tree is consistent, and I did not
want to change almost all headings.
* Some of the files could use more :c:func:`...` references and general
ReST polish.
But I don't want to make this patchset too large.
Jonathan Neuschäfer (8):
MAINTAINERS: GPIO: Add Documentation/driver-api/gpio/
Documentation: driver-api: Move gpio.rst to gpio/index.rst
Documentation: gpio: Move introduction to driver-api
Documentation: gpio: Move driver documentation to driver-api
Documentation: gpio: Move legacy documentation to driver-api
Documentation: gpio: Move gpiod_* consumer documentation to driver-api
Documentation: gpio: Move GPIO mapping documentation to driver-api
Documentation: gpio: Move drivers-on-gpio.txt to driver-api
.../{gpio/board.txt => driver-api/gpio/board.rst} | 39 +++++-----
.../consumer.txt => driver-api/gpio/consumer.rst} | 85 +++++++++++-----------
.../driver.txt => driver-api/gpio/driver.rst} | 80 ++++++++++----------
.../gpio/drivers-on-gpio.rst} | 1 +
.../driver-api/{gpio.rst => gpio/index.rst} | 21 +++---
.../{gpio/gpio.txt => driver-api/gpio/intro.rst} | 9 ++-
.../gpio-legacy.txt => driver-api/gpio/legacy.rst} | 68 ++++++++++-------
Documentation/driver-api/index.rst | 2 +-
Documentation/gpio/00-INDEX | 13 ----
Documentation/gpio/sysfs.txt | 5 +-
MAINTAINERS | 1 +
11 files changed, 169 insertions(+), 155 deletions(-)
rename Documentation/{gpio/board.txt => driver-api/gpio/board.rst} (88%)
rename Documentation/{gpio/consumer.txt => driver-api/gpio/consumer.rst} (89%)
rename Documentation/{gpio/driver.txt => driver-api/gpio/driver.rst} (93%)
rename Documentation/{gpio/drivers-on-gpio.txt => driver-api/gpio/drivers-on-gpio.rst} (99%)
rename Documentation/driver-api/{gpio.rst => gpio/index.rst} (74%)
rename Documentation/{gpio/gpio.txt => driver-api/gpio/intro.rst} (96%)
rename Documentation/{gpio/gpio-legacy.txt => driver-api/gpio/legacy.rst} (96%)
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH 3/8] Documentation: gpio: Move introduction to driver-api
From: Jonathan Neuschäfer @ 2018-03-08 23:40 UTC (permalink / raw)
To: linux-gpio
Cc: linux-kernel, linux-doc, Jonathan Neuschäfer, Linus Walleij,
Jonathan Corbet
In-Reply-To: <20180308234024.24145-1-j.neuschaefer@gmx.net>
Move gpio/intro.txt to driver-api/gpio/intro.rst and make sure it builds
cleanly as ReST.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
Documentation/driver-api/gpio/index.rst | 7 +++++++
Documentation/{gpio/gpio.txt => driver-api/gpio/intro.rst} | 9 +++++++--
Documentation/gpio/00-INDEX | 2 --
3 files changed, 14 insertions(+), 4 deletions(-)
rename Documentation/{gpio/gpio.txt => driver-api/gpio/intro.rst} (96%)
diff --git a/Documentation/driver-api/gpio/index.rst b/Documentation/driver-api/gpio/index.rst
index 6dd4aa647f27..db47d845f473 100644
--- a/Documentation/driver-api/gpio/index.rst
+++ b/Documentation/driver-api/gpio/index.rst
@@ -2,6 +2,13 @@
General Purpose Input/Output (GPIO)
===================================
+Contents:
+
+.. toctree::
+ :maxdepth: 2
+
+ intro
+
Core
====
diff --git a/Documentation/gpio/gpio.txt b/Documentation/driver-api/gpio/intro.rst
similarity index 96%
rename from Documentation/gpio/gpio.txt
rename to Documentation/driver-api/gpio/intro.rst
index cd9b356e88cd..74591489d0b5 100644
--- a/Documentation/gpio/gpio.txt
+++ b/Documentation/driver-api/gpio/intro.rst
@@ -1,3 +1,8 @@
+============
+Introduction
+============
+
+
GPIO Interfaces
===============
@@ -9,9 +14,9 @@ Due to the history of GPIO interfaces in the kernel, there are two different
ways to obtain and use GPIOs:
- The descriptor-based interface is the preferred way to manipulate GPIOs,
-and is described by all the files in this directory excepted gpio-legacy.txt.
+ and is described by all the files in this directory excepted gpio-legacy.txt.
- The legacy integer-based interface which is considered deprecated (but still
-usable for compatibility reasons) is documented in gpio-legacy.txt.
+ usable for compatibility reasons) is documented in gpio-legacy.txt.
The remainder of this document applies to the new descriptor-based interface.
gpio-legacy.txt contains the same information applied to the legacy
diff --git a/Documentation/gpio/00-INDEX b/Documentation/gpio/00-INDEX
index 179beb234f98..52fe0fa6c964 100644
--- a/Documentation/gpio/00-INDEX
+++ b/Documentation/gpio/00-INDEX
@@ -1,7 +1,5 @@
00-INDEX
- This file
-gpio.txt
- - Introduction to GPIOs and their kernel interfaces
consumer.txt
- How to obtain and use GPIOs in a driver
driver.txt
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 5/8] Documentation: gpio: Move legacy documentation to driver-api
From: Jonathan Neuschäfer @ 2018-03-08 23:40 UTC (permalink / raw)
To: linux-gpio
Cc: linux-kernel, linux-doc, Jonathan Neuschäfer, Linus Walleij,
Jonathan Corbet
In-Reply-To: <20180308234024.24145-1-j.neuschaefer@gmx.net>
Move gpio/gpio-legacy.txt to driver-api/gpio/legacy.rst and make sure it
builds cleanly as ReST.
Also move the legacy API reference from index.rst to legacy.rst.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
Documentation/driver-api/gpio/index.rst | 10 +---
.../gpio-legacy.txt => driver-api/gpio/legacy.rst} | 68 +++++++++++++---------
Documentation/gpio/00-INDEX | 2 -
3 files changed, 41 insertions(+), 39 deletions(-)
rename Documentation/{gpio/gpio-legacy.txt => driver-api/gpio/legacy.rst} (96%)
diff --git a/Documentation/driver-api/gpio/index.rst b/Documentation/driver-api/gpio/index.rst
index e1fbc5408cf6..fd22c0d1419e 100644
--- a/Documentation/driver-api/gpio/index.rst
+++ b/Documentation/driver-api/gpio/index.rst
@@ -9,6 +9,7 @@ Contents:
intro
driver
+ legacy
Core
====
@@ -19,15 +20,6 @@ Core
.. kernel-doc:: drivers/gpio/gpiolib.c
:export:
-Legacy API
-==========
-
-The functions listed in this section are deprecated. The GPIO descriptor based
-API described above should be used in new code.
-
-.. kernel-doc:: drivers/gpio/gpiolib-legacy.c
- :export:
-
ACPI support
============
diff --git a/Documentation/gpio/gpio-legacy.txt b/Documentation/driver-api/gpio/legacy.rst
similarity index 96%
rename from Documentation/gpio/gpio-legacy.txt
rename to Documentation/driver-api/gpio/legacy.rst
index 8356d0e78f67..5e9421e05f1d 100644
--- a/Documentation/gpio/gpio-legacy.txt
+++ b/Documentation/driver-api/gpio/legacy.rst
@@ -1,4 +1,6 @@
-GPIO Interfaces
+======================
+Legacy GPIO Interfaces
+======================
This provides an overview of GPIO access conventions on Linux.
@@ -129,7 +131,7 @@ The first thing a system should do with a GPIO is allocate it, using
the gpio_request() call; see later.
One of the next things to do with a GPIO, often in board setup code when
-setting up a platform_device using the GPIO, is mark its direction:
+setting up a platform_device using the GPIO, is mark its direction::
/* set as input or output, returning 0 or negative errno */
int gpio_direction_input(unsigned gpio);
@@ -164,7 +166,7 @@ Those don't need to sleep, and can safely be done from inside hard
(nonthreaded) IRQ handlers and similar contexts.
Use the following calls to access such GPIOs,
-for which gpio_cansleep() will always return false (see below):
+for which gpio_cansleep() will always return false (see below)::
/* GPIO INPUT: return zero or nonzero */
int gpio_get_value(unsigned gpio);
@@ -201,11 +203,11 @@ This requires sleeping, which can't be done from inside IRQ handlers.
Platforms that support this type of GPIO distinguish them from other GPIOs
by returning nonzero from this call (which requires a valid GPIO number,
-which should have been previously allocated with gpio_request):
+which should have been previously allocated with gpio_request)::
int gpio_cansleep(unsigned gpio);
-To access such GPIOs, a different set of accessors is defined:
+To access such GPIOs, a different set of accessors is defined::
/* GPIO INPUT: return zero or nonzero, might sleep */
int gpio_get_value_cansleep(unsigned gpio);
@@ -222,27 +224,27 @@ Other than the fact that these accessors might sleep, and will work
on GPIOs that can't be accessed from hardIRQ handlers, these calls act
the same as the spinlock-safe calls.
- ** IN ADDITION ** calls to setup and configure such GPIOs must be made
+**IN ADDITION** calls to setup and configure such GPIOs must be made
from contexts which may sleep, since they may need to access the GPIO
-controller chip too: (These setup calls are usually made from board
-setup or driver probe/teardown code, so this is an easy constraint.)
+controller chip too (These setup calls are usually made from board
+setup or driver probe/teardown code, so this is an easy constraint.)::
- gpio_direction_input()
- gpio_direction_output()
- gpio_request()
+ gpio_direction_input()
+ gpio_direction_output()
+ gpio_request()
-## gpio_request_one()
-## gpio_request_array()
-## gpio_free_array()
+ ## gpio_request_one()
+ ## gpio_request_array()
+ ## gpio_free_array()
- gpio_free()
- gpio_set_debounce()
+ gpio_free()
+ gpio_set_debounce()
Claiming and Releasing GPIOs
----------------------------
-To help catch system configuration errors, two calls are defined.
+To help catch system configuration errors, two calls are defined::
/* request GPIO, returning 0 or negative errno.
* non-null labels may be useful for diagnostics.
@@ -296,7 +298,7 @@ Also note that it's your responsibility to have stopped using a GPIO
before you free it.
Considering in most cases GPIOs are actually configured right after they
-are claimed, three additional calls are defined:
+are claimed, three additional calls are defined::
/* request a single GPIO, with initial configuration specified by
* 'flags', identical to gpio_request() wrt other arguments and
@@ -347,7 +349,7 @@ to make the pin LOW. The pin is make to HIGH by driving value 1 in output mode.
In the future, these flags can be extended to support more properties.
Further more, to ease the claim/release of multiple GPIOs, 'struct gpio' is
-introduced to encapsulate all three fields as:
+introduced to encapsulate all three fields as::
struct gpio {
unsigned gpio;
@@ -355,7 +357,7 @@ introduced to encapsulate all three fields as:
const char *label;
};
-A typical example of usage:
+A typical example of usage::
static struct gpio leds_gpios[] = {
{ 32, GPIOF_OUT_INIT_HIGH, "Power LED" }, /* default to ON */
@@ -380,7 +382,7 @@ GPIOs mapped to IRQs
--------------------
GPIO numbers are unsigned integers; so are IRQ numbers. These make up
two logically distinct namespaces (GPIO 0 need not use IRQ 0). You can
-map between them using calls like:
+map between them using calls like::
/* map GPIO numbers to IRQ numbers */
int gpio_to_irq(unsigned gpio);
@@ -446,12 +448,12 @@ A GPIO controller on a SOC might be tightly coupled with the pinctrl
subsystem, in the sense that the pins can be used by other functions
together with an optional gpio feature. We have already covered the
case where e.g. a GPIO controller need to reserve a pin or set the
-direction of a pin by calling any of:
+direction of a pin by calling any of::
-pinctrl_gpio_request()
-pinctrl_gpio_free()
-pinctrl_gpio_direction_input()
-pinctrl_gpio_direction_output()
+ pinctrl_gpio_request()
+ pinctrl_gpio_free()
+ pinctrl_gpio_direction_input()
+ pinctrl_gpio_direction_output()
But how does the pin control subsystem cross-correlate the GPIO
numbers (which are a global business) to a certain pin on a certain
@@ -565,7 +567,7 @@ If neither of these options are selected, the platform does not support
GPIOs through GPIO-lib and the code cannot be enabled by the user.
Trivial implementations of those functions can directly use framework
-code, which always dispatches through the gpio_chip:
+code, which always dispatches through the gpio_chip::
#define gpio_get_value __gpio_get_value
#define gpio_set_value __gpio_set_value
@@ -731,7 +733,7 @@ the correct GPIO number to use for a given signal.
Exporting from Kernel code
--------------------------
Kernel code can explicitly manage exports of GPIOs which have already been
-requested using gpio_request():
+requested using gpio_request()::
/* export the GPIO to userspace */
int gpio_export(unsigned gpio, bool direction_may_change);
@@ -756,3 +758,13 @@ After the GPIO has been exported, gpio_export_link() allows creating
symlinks from elsewhere in sysfs to the GPIO sysfs node. Drivers can
use this to provide the interface under their own device in sysfs with
a descriptive name.
+
+
+API Reference
+=============
+
+The functions listed in this section are deprecated. The GPIO descriptor based
+API should be used in new code.
+
+.. kernel-doc:: drivers/gpio/gpiolib-legacy.c
+ :export:
diff --git a/Documentation/gpio/00-INDEX b/Documentation/gpio/00-INDEX
index 06c25fb7604c..64cf61245861 100644
--- a/Documentation/gpio/00-INDEX
+++ b/Documentation/gpio/00-INDEX
@@ -9,5 +9,3 @@ board.txt
- How to assign GPIOs to a consumer device and a function
sysfs.txt
- Information about the GPIO sysfs interface
-gpio-legacy.txt
- - Historical documentation of the deprecated GPIO integer interface
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 1/8] MAINTAINERS: GPIO: Add Documentation/driver-api/gpio/
From: Jonathan Neuschäfer @ 2018-03-08 23:40 UTC (permalink / raw)
To: linux-gpio
Cc: linux-kernel, linux-doc, Jonathan Neuschäfer,
David S. Miller, Greg Kroah-Hartman, Mauro Carvalho Chehab,
Linus Walleij, Randy Dunlap
In-Reply-To: <20180308234024.24145-1-j.neuschaefer@gmx.net>
Steer patches to Documentation/driver-api/gpio/ into the right
direction.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index d6a89d31e4a4..313c0907020c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6029,6 +6029,7 @@ L: linux-gpio@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
S: Maintained
F: Documentation/devicetree/bindings/gpio/
+F: Documentation/driver-api/gpio/
F: Documentation/gpio/
F: Documentation/ABI/testing/gpio-cdev
F: Documentation/ABI/obsolete/sysfs-gpio
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 2/8] Documentation: driver-api: Move gpio.rst to gpio/index.rst
From: Jonathan Neuschäfer @ 2018-03-08 23:40 UTC (permalink / raw)
To: linux-gpio
Cc: linux-kernel, linux-doc, Jonathan Neuschäfer,
Jonathan Corbet, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Linus Walleij, Vinod Koul, Sanyog Kale, Sagar Dharia,
Thierry Reding
In-Reply-To: <20180308234024.24145-1-j.neuschaefer@gmx.net>
To make space for more files in the GPIO section, create a
Documentation/driver-api/gpio/ directory.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
Documentation/driver-api/{gpio.rst => gpio/index.rst} | 0
Documentation/driver-api/index.rst | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename Documentation/driver-api/{gpio.rst => gpio/index.rst} (100%)
diff --git a/Documentation/driver-api/gpio.rst b/Documentation/driver-api/gpio/index.rst
similarity index 100%
rename from Documentation/driver-api/gpio.rst
rename to Documentation/driver-api/gpio/index.rst
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
index 62d056471c0d..9b54fb99d9ca 100644
--- a/Documentation/driver-api/index.rst
+++ b/Documentation/driver-api/index.rst
@@ -45,7 +45,7 @@ available subsections can be seen below.
uio-howto
firmware/index
pinctl
- gpio
+ gpio/index
misc_devices
dmaengine/index
slimbus
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 8/8] Documentation: gpio: Move drivers-on-gpio.txt to driver-api
From: Jonathan Neuschäfer @ 2018-03-08 23:40 UTC (permalink / raw)
To: linux-gpio
Cc: linux-kernel, linux-doc, Jonathan Neuschäfer, Linus Walleij,
Jonathan Corbet
In-Reply-To: <20180308234024.24145-1-j.neuschaefer@gmx.net>
Move gpio/drivers-on-gpio.txt to driver-api/gpio/drivers-on-gpio.rst and
make sure it builds cleanly as ReST.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
This patch applies cleanly on top of 93db446a424c ("mtd: nand: move raw
NAND related code to the raw/ subdir")
---
.../drivers-on-gpio.txt => driver-api/gpio/drivers-on-gpio.rst} | 1 +
Documentation/driver-api/gpio/index.rst | 1 +
Documentation/gpio/00-INDEX | 3 ---
Documentation/gpio/sysfs.txt | 5 ++---
4 files changed, 4 insertions(+), 6 deletions(-)
rename Documentation/{gpio/drivers-on-gpio.txt => driver-api/gpio/drivers-on-gpio.rst} (99%)
diff --git a/Documentation/gpio/drivers-on-gpio.txt b/Documentation/driver-api/gpio/drivers-on-gpio.rst
similarity index 99%
rename from Documentation/gpio/drivers-on-gpio.txt
rename to Documentation/driver-api/gpio/drivers-on-gpio.rst
index a3e612f55bc7..7da0c1dd1f7a 100644
--- a/Documentation/gpio/drivers-on-gpio.txt
+++ b/Documentation/driver-api/gpio/drivers-on-gpio.rst
@@ -1,3 +1,4 @@
+============================
Subsystem drivers using GPIO
============================
diff --git a/Documentation/driver-api/gpio/index.rst b/Documentation/driver-api/gpio/index.rst
index 2b73ea5a1fbb..6a374ded1287 100644
--- a/Documentation/driver-api/gpio/index.rst
+++ b/Documentation/driver-api/gpio/index.rst
@@ -11,6 +11,7 @@ Contents:
driver
consumer
board
+ drivers-on-gpio
legacy
Core
diff --git a/Documentation/gpio/00-INDEX b/Documentation/gpio/00-INDEX
index 650cb0696211..17e19a68058f 100644
--- a/Documentation/gpio/00-INDEX
+++ b/Documentation/gpio/00-INDEX
@@ -1,7 +1,4 @@
00-INDEX
- This file
-drivers-on-gpio.txt:
- - Drivers in other subsystems that can use GPIO to provide more
- complex functionality.
sysfs.txt
- Information about the GPIO sysfs interface
diff --git a/Documentation/gpio/sysfs.txt b/Documentation/gpio/sysfs.txt
index 6cdeab8650cd..58eeab81f349 100644
--- a/Documentation/gpio/sysfs.txt
+++ b/Documentation/gpio/sysfs.txt
@@ -32,9 +32,8 @@ standard kernels won't know about. And for some tasks, simple userspace
GPIO drivers could be all that the system really needs.
DO NOT ABUSE SYSFS TO CONTROL HARDWARE THAT HAS PROPER KERNEL DRIVERS.
-PLEASE READ THE DOCUMENT NAMED "drivers-on-gpio.txt" IN THIS DOCUMENTATION
-DIRECTORY TO AVOID REINVENTING KERNEL WHEELS IN USERSPACE. I MEAN IT.
-REALLY.
+PLEASE READ THE DOCUMENT AT Documentation/driver-api/gpio/drivers-on-gpio.rst
+TO AVOID REINVENTING KERNEL WHEELS IN USERSPACE. I MEAN IT. REALLY.
Paths in Sysfs
--------------
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 6/8] Documentation: gpio: Move gpiod_* consumer documentation to driver-api
From: Jonathan Neuschäfer @ 2018-03-08 23:40 UTC (permalink / raw)
To: linux-gpio
Cc: linux-kernel, linux-doc, Jonathan Neuschäfer, Linus Walleij,
Jonathan Corbet
In-Reply-To: <20180308234024.24145-1-j.neuschaefer@gmx.net>
Move gpio/consumer.txt to driver-api/gpio/consumer.rst and make sure it
builds cleanly as ReST.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
.../consumer.txt => driver-api/gpio/consumer.rst} | 85 +++++++++++-----------
Documentation/driver-api/gpio/index.rst | 1 +
Documentation/gpio/00-INDEX | 2 -
3 files changed, 44 insertions(+), 44 deletions(-)
rename Documentation/{gpio/consumer.txt => driver-api/gpio/consumer.rst} (89%)
diff --git a/Documentation/gpio/consumer.txt b/Documentation/driver-api/gpio/consumer.rst
similarity index 89%
rename from Documentation/gpio/consumer.txt
rename to Documentation/driver-api/gpio/consumer.rst
index d53e5b5cfc9c..c71a50d85b50 100644
--- a/Documentation/gpio/consumer.txt
+++ b/Documentation/driver-api/gpio/consumer.rst
@@ -1,3 +1,4 @@
+==================================
GPIO Descriptor Consumer Interface
==================================
@@ -30,10 +31,10 @@ warnings. These stubs are used for two use cases:
be met with console warnings that may be perceived as intimidating.
All the functions that work with the descriptor-based GPIO interface are
-prefixed with gpiod_. The gpio_ prefix is used for the legacy interface. No
-other function in the kernel should use these prefixes. The use of the legacy
-functions is strongly discouraged, new code should use <linux/gpio/consumer.h>
-and descriptors exclusively.
+prefixed with ``gpiod_``. The ``gpio_`` prefix is used for the legacy
+interface. No other function in the kernel should use these prefixes. The use
+of the legacy functions is strongly discouraged, new code should use
+<linux/gpio/consumer.h> and descriptors exclusively.
Obtaining and Disposing GPIOs
@@ -43,13 +44,13 @@ With the descriptor-based interface, GPIOs are identified with an opaque,
non-forgeable handler that must be obtained through a call to one of the
gpiod_get() functions. Like many other kernel subsystems, gpiod_get() takes the
device that will use the GPIO and the function the requested GPIO is supposed to
-fulfill:
+fulfill::
struct gpio_desc *gpiod_get(struct device *dev, const char *con_id,
enum gpiod_flags flags)
If a function is implemented by using several GPIOs together (e.g. a simple LED
-device that displays digits), an additional index argument can be specified:
+device that displays digits), an additional index argument can be specified::
struct gpio_desc *gpiod_get_index(struct device *dev,
const char *con_id, unsigned int idx,
@@ -84,7 +85,7 @@ occurred while trying to acquire it. This is useful to discriminate between mere
errors and an absence of GPIO for optional GPIO parameters. For the common
pattern where a GPIO is optional, the gpiod_get_optional() and
gpiod_get_index_optional() functions can be used. These functions return NULL
-instead of -ENOENT if no GPIO has been assigned to the requested function:
+instead of -ENOENT if no GPIO has been assigned to the requested function::
struct gpio_desc *gpiod_get_optional(struct device *dev,
const char *con_id,
@@ -101,14 +102,14 @@ This is helpful to driver authors, since they do not need to special case
-ENOSYS return codes. System integrators should however be careful to enable
gpiolib on systems that need it.
-For a function using multiple GPIOs all of those can be obtained with one call:
+For a function using multiple GPIOs all of those can be obtained with one call::
struct gpio_descs *gpiod_get_array(struct device *dev,
const char *con_id,
enum gpiod_flags flags)
This function returns a struct gpio_descs which contains an array of
-descriptors:
+descriptors::
struct gpio_descs {
unsigned int ndescs;
@@ -116,13 +117,13 @@ descriptors:
}
The following function returns NULL instead of -ENOENT if no GPIOs have been
-assigned to the requested function:
+assigned to the requested function::
struct gpio_descs *gpiod_get_array_optional(struct device *dev,
const char *con_id,
enum gpiod_flags flags)
-Device-managed variants of these functions are also defined:
+Device-managed variants of these functions are also defined::
struct gpio_desc *devm_gpiod_get(struct device *dev, const char *con_id,
enum gpiod_flags flags)
@@ -149,11 +150,11 @@ Device-managed variants of these functions are also defined:
const char *con_id,
enum gpiod_flags flags)
-A GPIO descriptor can be disposed of using the gpiod_put() function:
+A GPIO descriptor can be disposed of using the gpiod_put() function::
void gpiod_put(struct gpio_desc *desc)
-For an array of GPIOs this function can be used:
+For an array of GPIOs this function can be used::
void gpiod_put_array(struct gpio_descs *descs)
@@ -161,7 +162,7 @@ It is strictly forbidden to use a descriptor after calling these functions.
It is also not allowed to individually release descriptors (using gpiod_put())
from an array acquired with gpiod_get_array().
-The device-managed variants are, unsurprisingly:
+The device-managed variants are, unsurprisingly::
void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
@@ -175,7 +176,7 @@ Setting Direction
-----------------
The first thing a driver must do with a GPIO is setting its direction. If no
direction-setting flags have been given to gpiod_get*(), this is done by
-invoking one of the gpiod_direction_*() functions:
+invoking one of the gpiod_direction_*() functions::
int gpiod_direction_input(struct gpio_desc *desc)
int gpiod_direction_output(struct gpio_desc *desc, int value)
@@ -189,7 +190,7 @@ of early board setup.
For output GPIOs, the value provided becomes the initial output value. This
helps avoid signal glitching during system startup.
-A driver can also query the current direction of a GPIO:
+A driver can also query the current direction of a GPIO::
int gpiod_get_direction(const struct gpio_desc *desc)
@@ -206,7 +207,7 @@ Most GPIO controllers can be accessed with memory read/write instructions. Those
don't need to sleep, and can safely be done from inside hard (non-threaded) IRQ
handlers and similar contexts.
-Use the following calls to access GPIOs from an atomic context:
+Use the following calls to access GPIOs from an atomic context::
int gpiod_get_value(const struct gpio_desc *desc);
void gpiod_set_value(struct gpio_desc *desc, int value);
@@ -231,11 +232,11 @@ head of a queue to transmit a command and get its response. This requires
sleeping, which can't be done from inside IRQ handlers.
Platforms that support this type of GPIO distinguish them from other GPIOs by
-returning nonzero from this call:
+returning nonzero from this call::
int gpiod_cansleep(const struct gpio_desc *desc)
-To access such GPIOs, a different set of accessors is defined:
+To access such GPIOs, a different set of accessors is defined::
int gpiod_get_value_cansleep(const struct gpio_desc *desc)
void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
@@ -271,23 +272,23 @@ As an example, if the active low property for a dedicated GPIO is set, and the
gpiod_set_(array)_value_xxx() passes "asserted" ("1"), the physical line level
will be driven low.
-To summarize:
-
-Function (example) line property physical line
-gpiod_set_raw_value(desc, 0); don't care low
-gpiod_set_raw_value(desc, 1); don't care high
-gpiod_set_value(desc, 0); default (active high) low
-gpiod_set_value(desc, 1); default (active high) high
-gpiod_set_value(desc, 0); active low high
-gpiod_set_value(desc, 1); active low low
-gpiod_set_value(desc, 0); default (active high) low
-gpiod_set_value(desc, 1); default (active high) high
-gpiod_set_value(desc, 0); open drain low
-gpiod_set_value(desc, 1); open drain high impedance
-gpiod_set_value(desc, 0); open source high impedance
-gpiod_set_value(desc, 1); open source high
-
-It is possible to override these semantics using the *set_raw/'get_raw functions
+To summarize::
+
+ Function (example) line property physical line
+ gpiod_set_raw_value(desc, 0); don't care low
+ gpiod_set_raw_value(desc, 1); don't care high
+ gpiod_set_value(desc, 0); default (active high) low
+ gpiod_set_value(desc, 1); default (active high) high
+ gpiod_set_value(desc, 0); active low high
+ gpiod_set_value(desc, 1); active low low
+ gpiod_set_value(desc, 0); default (active high) low
+ gpiod_set_value(desc, 1); default (active high) high
+ gpiod_set_value(desc, 0); open drain low
+ gpiod_set_value(desc, 1); open drain high impedance
+ gpiod_set_value(desc, 0); open source high impedance
+ gpiod_set_value(desc, 1); open source high
+
+It is possible to override these semantics using the set_raw/get_raw functions
but it should be avoided as much as possible, especially by system-agnostic drivers
which should not need to care about the actual physical line level and worry about
the logical value instead.
@@ -300,7 +301,7 @@ their device will actually receive, no matter what lies between it and the GPIO
line.
The following set of calls ignore the active-low or open drain property of a GPIO and
-work on the raw line value:
+work on the raw line value::
int gpiod_get_raw_value(const struct gpio_desc *desc)
void gpiod_set_raw_value(struct gpio_desc *desc, int value)
@@ -308,7 +309,7 @@ work on the raw line value:
void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value)
int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
-The active low state of a GPIO can also be queried using the following call:
+The active low state of a GPIO can also be queried using the following call::
int gpiod_is_active_low(const struct gpio_desc *desc)
@@ -318,7 +319,7 @@ should not have to care about the physical line level or open drain semantics.
Access multiple GPIOs with a single function call
-------------------------------------------------
-The following functions get or set the values of an array of GPIOs:
+The following functions get or set the values of an array of GPIOs::
int gpiod_get_array_value(unsigned int array_size,
struct gpio_desc **desc_array,
@@ -361,7 +362,7 @@ The functions take three arguments:
The descriptor array can be obtained using the gpiod_get_array() function
or one of its variants. If the group of descriptors returned by that function
matches the desired group of GPIOs, those GPIOs can be accessed by simply using
-the struct gpio_descs returned by gpiod_get_array():
+the struct gpio_descs returned by gpiod_get_array()::
struct gpio_descs *my_gpio_descs = gpiod_get_array(...);
gpiod_set_array_value(my_gpio_descs->ndescs, my_gpio_descs->desc,
@@ -384,7 +385,7 @@ values are stored in value_array rather than passed back as return value.
GPIOs mapped to IRQs
--------------------
GPIO lines can quite often be used as IRQs. You can get the IRQ number
-corresponding to a given GPIO using the following call:
+corresponding to a given GPIO using the following call::
int gpiod_to_irq(const struct gpio_desc *desc)
@@ -424,7 +425,7 @@ Interacting With the Legacy GPIO Subsystem
Many kernel subsystems still handle GPIOs using the legacy integer-based
interface. Although it is strongly encouraged to upgrade them to the safer
descriptor-based API, the following two functions allow you to convert a GPIO
-descriptor into the GPIO integer namespace and vice-versa:
+descriptor into the GPIO integer namespace and vice-versa::
int desc_to_gpio(const struct gpio_desc *desc)
struct gpio_desc *gpio_to_desc(unsigned gpio)
diff --git a/Documentation/driver-api/gpio/index.rst b/Documentation/driver-api/gpio/index.rst
index fd22c0d1419e..6ba9e0043310 100644
--- a/Documentation/driver-api/gpio/index.rst
+++ b/Documentation/driver-api/gpio/index.rst
@@ -9,6 +9,7 @@ Contents:
intro
driver
+ consumer
legacy
Core
diff --git a/Documentation/gpio/00-INDEX b/Documentation/gpio/00-INDEX
index 64cf61245861..f960fc00a3ef 100644
--- a/Documentation/gpio/00-INDEX
+++ b/Documentation/gpio/00-INDEX
@@ -1,7 +1,5 @@
00-INDEX
- This file
-consumer.txt
- - How to obtain and use GPIOs in a driver
drivers-on-gpio.txt:
- Drivers in other subsystems that can use GPIO to provide more
complex functionality.
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox